Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added clone in distrobox assemble #1618

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions distrobox-assemble
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ entry=""
home=""
hostname=""
image=""
clone=""
init=""
init_hooks=""
nvidia=""
Expand Down Expand Up @@ -272,6 +273,7 @@ run_distrobox()
home=""
hostname=""
image=""
clone=""
init=""
init_hooks=""
nvidia=""
Expand Down Expand Up @@ -342,6 +344,9 @@ run_distrobox()
if [ -n "${image}" ]; then
result_command="${result_command} --image $(sanitize_variable "${image}")"
fi
if [ -n "${clone}" ]; then
result_command="${result_command} --clone $(sanitize_variable "${clone}")"
fi
if [ -n "${init}" ] && [ "${init}" -eq 1 ]; then
result_command="${result_command} --init"
fi
Expand Down
37 changes: 37 additions & 0 deletions docs/usage/distrobox-assemble.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ You can always test what distrobox **would do** by using the `--dry-run` flag.
This command will only print what commands distrobox would do without actually
running them.

**Clone**

**Disclaimer**: You need to start the container once to ensure it is fully initialized and created before cloning it. The container being copied must also be stopped before the cloning process can proceed.

**Available options**

This is a list of available options with the corresponding type:
Expand All @@ -120,6 +124,7 @@ declared multiple times to be compounded:
| additional_packages | string_list | Additional packages to install inside the container |
| home | string | Which home directory should the container use |
| image | string | Which image should the container use, look [here](../compatibility.md) for a list |
| clone | string | Name of the Distrobox container to use as the base for a new container (the container must be stopped). |
| init_hooks | string_list | Commands to run inside the container, after the packages setup |
| pre_init_hooks | string_list | Commands to run inside the container, before the packages setup |
| volume | string_list | Additional volumes to mount inside the containers |
Expand Down Expand Up @@ -168,3 +173,35 @@ each option corresponds to one of the `create` flags.
exported_apps="htop"
exported_bins="/usr/bin/htop /usr/bin/git"
exported_bins_path="~/.local/bin"

**Clone example**

[ubuntu]
additional_packages="git vim tmux"
image=ubuntu:latest
init=false
nvidia=false
pull=true
root=false
replace=true
start_now=true

[deno_ubuntu]
clone=ubuntu
init=false
nvidia=false
pull=true
root=false
replace=true
start_now=true
pre_init_hooks=curl -fsSL https://deno.land/install.sh | sh;

[bun_ubuntu]
clone=ubuntu
init=false
nvidia=false
pull=true
root=false
replace=true
start_now=true
pre_init_hooks=curl -fsSL https://bun.sh/install | bash;