以前的徽标信用 J4ckr3D
当前徽标信用 David Lapshin
使用终端内的任何 Linux 发行版。实现与软件的向后和向前兼容性,并自由使用你更熟悉的任何发行版。Distrobox 使用 ,或者使用你选择的 Linux 发行版创建容器。创建的容器将与主机紧密集成,允许共享用户的HOME目录,外部存储,外部USB设备和图形应用程序(X11 / Wayland)以及音频。
podman
docker
lilipod
Simply put it's a fancy wrapper around , or to create and start containers highly integrated with the hosts.
podman
docker
lilipod
The distrobox environment is based on an OCI image. This image is used to create a container that seamlessly integrates with the rest of the operating system by providing access to the user's home directory, the Wayland and X11 sockets, networking, removable devices (like USB sticks), systemd journal, SSH agent, D-Bus, ulimits, /dev and the udev database, etc...
It implements the same concepts introduced by https://github.com/containers/toolbox but in a simplified way using POSIX sh and aiming at broader compatibility.
All the props go to them as they had the great idea to implement this stuff.
It is divided into 12 commands:
distrobox-assemble- creates and destroy containers based on a config file
distrobox-create- creates the container
distrobox-enter- to enter the container
distrobox-ephemeral- create a temporal container, destroy it when exiting the shell
distrobox-list- to list containers created with distrobox
distrobox-rm- to delete a container created with distrobox
distrobox-stop- to stop a running container created with distrobox
distrobox-upgrade- to upgrade one or more running containers created with distrobox at once
distrobox-generate-entry- to create an entry of a created container in the applications list
distrobox-init- the entrypoint of the container (not meant to be used manually)
distrobox-export- it is meant to be used inside the container, useful to export apps and services from the container to the host
distrobox-host-exec- to run commands/programs from the host, while inside of the container
It also includes a little wrapper to launch commands with instead of calling the single files.
distrobox COMMAND
Please check the usage docs here and see some handy tips on how to use it
Thanks to castrojo, you can see Distrobox in action in this explanatory video on his setup with Distrobox, Toolbx, Fedora Silverblue for the uBlue project (check it out!)
Refer to the compatibility list for an overview of supported host's distro HERE and container's distro HERE.
This project aims to bring any distro userland to any other distro supporting podman, docker or lilipod. It has been written in POSIX sh to be as portable as possible and not have problems with dependencies and glibc version's compatibility.
Refer HERE for a list of supported container managers and minimum supported versions.
It also aims to enter the container as fast as possible, every millisecond adds up if you use the container as your default environment for your terminal:
These are some sample results of on the same container on my weak laptop:
distrobox-enter
~$ hyperfine --warmup 3 --runs 100 "distrobox enter bench -- whoami"
Benchmark 1: distrobox enter bench -- whoami
Time (mean ± σ): 395.6 ms ± 10.5 ms [User: 167.4 ms, System: 62.4 ms]
Range (min … max): 297.3 ms … 408.9 ms 100 runs
隔离和沙盒不是该项目的主要目标,相反,它旨在将容器与主机紧密集成。容器将完全访问你的家、笔式驱动器等,因此不要指望它像普通的 docker/podman 容器或 flatpak 那样高度沙盒化。
--root/-r
也就是说,它正在实现与主机的某种解耦,如下所述: #28 沙盒模式
创建一个新的外装箱:
distrobox create -n test
使用 Systemd 创建一个新的发行版(类似于 LXC):
distrobox create --name test --init --image debian:latest --additional-packages "systemd libpam-systemd"
输入创建的发行版:
distrobox enter test
添加一个具有不同发行版的发行版,例如 Ubuntu 20.04:
distrobox create -i ubuntu:20.04
在发行版中执行命令:
distrobox enter test -- command-to-execute
列出正在运行的发行版:
distrobox list
停止正在运行的发行版:
distrobox stop test
删除外箱:
distrobox rm test
你可以查看 这里 了解更多高级用法,并查看有用的提示的完整列表 这里
清单文件可用于声明一组发行版,并用于批量创建/销毁它们。
distrobox-assemble
查看distrobox-assemble的使用文档以获取更详细的指南。
配置文件可以放置在以下路径中,从最不重要到最重要的路径:
你可以指定内部发行版配置和特定于发行版箱的环境变量。
示例配置文件:
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:
Distrobox is packaged in the following distributions, if your distribution is on this list, you can refer to your repos for installation:
Thanks to the maintainers for their work: M0Rf30, alcir, dfaggioli, AtilaSaraiva, michel-slm
Here is a list of alternative ways to install distrobox
If you like to live your life dangerously, or you want the latest release, you can trust me and simply run this in your terminal:
curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/install | sudo sh
# or using wget
wget -qO- https://raw.githubusercontent.com/89luca89/distrobox/main/install | sudo sh
or if you want to select a custom directory to install without sudo:
curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/install | sh -s -- --prefix ~/.local
# or using wget
wget -qO- https://raw.githubusercontent.com/89luca89/distrobox/main/install | sh -s -- --prefix ~/.local
If you want to install the last development version, directly from last commit on git, you can use:
curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/install | sudo sh -s -- --next
# or using wget
wget -qO- https://raw.githubusercontent.com/89luca89/distrobox/main/install | sudo sh -s -- --next
or:
curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/install | sh -s -- --next --prefix ~/.local
# or using wget
wget -qO- https://raw.githubusercontent.com/89luca89/distrobox/main/install | sh -s -- --next --prefix ~/.local
Warning Remember to add prefix-path-you-choose/bin to your PATH, to make it work.
Alternatively you can clone the project using
git cloneor using the latest release HERE.
Enter the directory and run
./install, by default it will attempt to install in
~/.localbut if you run the script as root, it will default to
/usr/local. You can specify a custom directory with the
--prefixflag such as
./install --prefix ~/.distrobox.
Prefix explained: main distrobox files get installed to
${prefix}/binwhereas the manpages get installed to
${prefix}/share/man.
Check the Host Distros compatibility list for distro-specific instructions.
Distrobox depends on a container manager to work, you can choose to install either podman, docker or lilipod.
Please look in the Compatibility Table for your distribution notes.
There are ways to install Podman without root privileges and in home. or Lilipod without root privileges and in home. This should play well with completely sudoless setups and with devices like the Steam Deck (SteamOS).
If you installed distrobox using the
installscript in the default install directory use this:
curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/uninstall | sudo sh
or if you specified a custom path:
curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/uninstall | sh -s -- --prefix ~/.local
Else if cloned the project using
git cloneor using the latest archive release from HERE,
enter the directory and run
./uninstall, by default it will assume the install directory was
/usr/localif ran as root or
~/.local, you can specify another directory if needed with
./uninstall --prefix ~/.local
This artwork uses Cardboard Box model by J0Y
licensed under Creative Commons Attribution 4.0
This artwork uses GTK Loop Animation
by GNOME Project
licensed under Creative Commons Attribution-ShareAlike 3.0
as a pre-configured scene