官网: https://github.com/89luca89/distrobox
An error occured when installing basic packages for gentoo #530 https://github.com/89luca89/distrobox/issues/530
[Suggestion] Progress for "Installing basic packages" #1233 https://github.com/89luca89/distrobox/issues/1233
debian 11 上,也可使用,就是 podman 的版本有点低,官方仓库里的是 3.0.1。这类与内核密切相关的 app,自己安装太麻烦了;debian 12 才能 apt 安装官方仓库里的,debian 11 可能只能采用采用源码,自行编译的方式来安装;snap 包在 11上好像安装不了?distrobox 采用 1.7.2.1 https://github.com/89luca89/distrobox/tags
初步测试,OK。深入测试:没有做。
======================================
Progress for "Installing basic packages
[Suggestion] Progress for "Installing basic packages" #1233 https://github.com/89luca89/distrobox/issues/1233
$ distrobox enter u-2204
问题:
一直卡在:Starting container... [OK] Installing basic packages... ,长时间没有变化,并且,没有进度显示,会被误以为 宕机 了。
解决:
在宿主机上,新开一个终端窗口,运行命令:
Right now you can follow with
podman/docker logs -f name-of-distrobox
podman logs -f u-2204
- u-2204 是由 distrobox 采用例如 distrobox create --image ubuntu:22.04 --name u-2204 这条命令,所创建的容器。
$ distrobox create --image ubuntu:22.04 --name u-2204
说明:
1. 圈 2,长时间没有变化,被误以为容器挂掉了。
2. 圈 3,在宿主机中,新开终端窗口,并输入如下命令:
podman/docker logs -f name-of-distrobox
注:在运行此命令之前,容器必须已经是有效的。
有效,是指在能够正常运行了 $ distrobox enter u-2204 这条语句之后,或者正在运行中的容器。
3. 圈 4,可以看到下载的过程,这样看网速,以及基础镜像的大小了。
///
$ podman logs -h
Fetch the logs of one or more containers
Description:
Retrieves logs for one or more containers.
This does not guarantee execution order when combined with podman run (i.e., your run may not have generated any logs at the time you execute podman logs).
Usage:
podman logs [options] CONTAINER [CONTAINER...]
Examples:
podman logs ctrID
podman logs --names ctrID1 ctrID2
podman logs --tail 2 mywebserver
podman logs --follow=true --since 10m ctrID
podman logs mywebserver mydbserver
Options:
--color Output the containers with different colors in the log.
-f, --follow Follow log output. The default is false
-l, --latest Act on the latest container podman is aware of
Not supported with the "--remote" flag
-n, --names Output the container name in the log
--since string Show logs since TIMESTAMP
--tail int Output the specified number of LINES at the end of the logs. Defaults to -1, which prints all lines (default -1)
-t, --timestamps Output the timestamps in the log
--until string Show logs until TIMESTAMP
----------------------------------------------------------
$ podman logs -f my-ubuntu-container
+ stat /run/host/etc/shadow
+ stat -c %u /run/host/etc/shadow
+ [ 65534 = 0 ]
+ [ -n ]
+ printf distrobox: Installing basic packages...\n
distrobox: Installing basic packages...
+ basename bash
+ shell_pkg=bash
+ [ bash = ash ]
+ missing_packages=0
+ dependencies=
bc
bzip2
chpasswd
curl
diff
find
findmnt
gpg
hostname
less
lsof
man
mount
passwd
pigz
pinentry
ping
ps
rsync
script
ssh
sudo
time
tree
umount
unzip
useradd
wc
wget
xauth
zip
bash+ command -v bc
+ missing_packages=1
+ break
+ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/bin:/sbin:/usr/bin:/usr/sbin
+ [ 0 -ne 0 ]
+ [ 1 -ne 0 ]
+ command -v apk
+ command -v apt-get
/usr/bin/apt-get
+ export DEBIAN_FRONTEND=noninteractive
+ [ 0 -ne 0 ]
+ rm -f /etc/dpkg/dpkg.cfg.d/excludes
+ apt-get update
Get:1 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]
Get:2 http://archive.ubuntu.com/ubuntu noble InRelease [256 kB]
Get:3 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages [137 kB]
=================================
Quick Start
官网: https://github.com/89luca89/distrobox
Create a new distrobox:
distrobox create -n test
Create a new distrobox with Systemd (acts similar to an LXC):
distrobox create --name test --init --image debian:latest --additional-packages "systemd libpam-systemd"
LXC 是 Linux Container 的简写。Linux Container 是一种内核虚拟化技术,可以提供轻量级的虚拟化以便隔离进程和资源。 https://blog.csdn.net/ken2232/article/details/139493394
Enter created distrobox:
distrobox enter test
Add one with a different distribution, eg. Ubuntu 20.04:
distrobox create -i ubuntu:20.04
Execute a command in a distrobox:
distrobox enter test -- command-to-execute
List running distroboxes:
distrobox list
Stop a running distrobox:
distrobox stop test
Remove a distrobox:
distrobox rm test
You can check HERE for more advanced usage and check a comprehensive list of useful tips HERE
Assemble Distrobox
Manifest files can be used to declare a set of distroboxes and use distrobox-assemble
to create/destroy them in batch.
Head over the usage docs of distrobox-assemble for a more detailed guide.
Configure Distrobox
Configuration files can be placed in the following paths, from the least important to the most important:
- /usr/share/distrobox/distrobox.conf
- /usr/etc/distrobox/distrobox.conf
- /etc/distrobox/distrobox.conf
- ${HOME}/.config/distrobox/distrobox.conf
- ${HOME}/.distroboxrc
You can specify inside distrobox configurations and distrobox-specific Environment variables.
Example configuration file:
container_always_pull="1"
container_generate_entry=0
container_manager="docker"
container_image_default="registry.opensuse.org/opensuse/toolbox:latest"
container_name_default="test-name-1"
container_user_custom_home="$HOME/.local/share/container-home-test"
container_init_hook="~/.local/distrobox/a_custom_default_init_hook.sh"
container_pre_init_hook="~/a_custom_default_pre_init_hook.sh"
container_manager_additional_flags="--env-file /path/to/file --custom-flag"
container_additional_volumes="/example:/example1 /example2:/example3:ro"
non_interactive="1"
skip_workdir="0"
PATH="$PATH:/path/to/custom/podman"
Alternatively, it is possible to specify preferences using ENV variables:
- DBX_CONTAINER_ALWAYS_PULL
- DBX_CONTAINER_CUSTOM_HOME
- DBX_CONTAINER_IMAGE
- DBX_CONTAINER_MANAGER
- DBX_CONTAINER_NAME
- DBX_CONTAINER_ENTRY
- DBX_NON_INTERACTIVE
- DBX_SKIP_WORKDIR