Skip to content

cmd/create: add --volume option to allow mounting host directories#1809

Open
isiin wants to merge 2 commits into
containers:mainfrom
isiin:feature/add-custom-volumes
Open

cmd/create: add --volume option to allow mounting host directories#1809
isiin wants to merge 2 commits into
containers:mainfrom
isiin:feature/add-custom-volumes

Conversation

@isiin

@isiin isiin commented Jun 24, 2026

Copy link
Copy Markdown

Allow mounting host directories into Toolbx containers. This option provides
a way to integrate specialized host-side environments (such as Nix or custom developer toolchains) without sacrificing the container's integrity or modifying shell configuration files.
Fixes: #1600

  • cmd/create: Add --volume option to 'toolbox create'
  • doc/toolbox.create.1.md: Update man page to document the new option and
    provide usage guidance and safety warnings.
  • system/101-create.bats: Add a test for create with --volume option

@isiin isiin requested a review from debarshiray as a code owner June 24, 2026 14:01

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for custom volumes in Toolbx containers via a new --volume flag on the create command. It updates the CLI flags, container creation logic, documentation, and adds a system test. The feedback suggests using StringArrayVar instead of StringArrayVarP for the --volume flag since it does not have a shorthand character, which aligns better with the codebase's existing style.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/cmd/create.go
Comment on lines +108 to +112
flags.StringArrayVarP(&createFlags.volume,
"volume",
"",
[]string{},
"Bind mount a volume into the Toolbx container")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since the --volume flag does not have a shorthand character, it is more idiomatic and consistent with the rest of the file (such as the --authfile flag on line 79) to use StringArrayVar instead of StringArrayVarP with an empty shorthand string.

	flags.StringArrayVar(&createFlags.volume,
		"volume",
		[]string{},
		"Bind mount a volume into the Toolbx container")
References
  1. Prioritize consistency with the existing code style over minor refactorings like inlining variables, especially when the current pattern is used throughout the codebase.

@isiin isiin force-pushed the feature/add-custom-volumes branch from 1ee3486 to 8479421 Compare June 24, 2026 14:36
Allow mounting host directories into Toolbx containers. This option
provides
a way to integrate specialized host-side environments (such as Nix or
custom developer toolchains) without sacrificing the container's
integrity or modifying shell configuration files.
Fixes: containers#1600

- cmd/create: Add --volume option to 'toolbox create'
- doc/toolbox.create.1.md: Update man page to document the new option
and
  provide usage guidance and safety warnings.
- system/101-create.bats: Add a test for create with --volume option

Signed-off-by: isiin <isiin@abeam.ocn.ne.jp>
containers#1809
isiin added a commit to isiin/toolbox that referenced this pull request Jun 24, 2026
Per feedback on code style consistency, I have introduced '-V' as the
shorthand for '--volume'. This justifies the use of StringArrayVarP and
improves user experience by providing a consistent CLI interface.

Signed-off-by: isiin <isiin@abeam.ocn.ne.jp>
containers#1809
@isiin isiin force-pushed the feature/add-custom-volumes branch from 8479421 to 0b1c2df Compare June 24, 2026 14:47
isiin added a commit to isiin/toolbox that referenced this pull request Jun 24, 2026
Per feedback on code style consistency, I have introduced '-V' as the
shorthand for '--volume'. This justifies the use of StringArrayVarP and
improves user experience by providing a consistent CLI interface.

Signed-off-by: isiin <isiin@abeam.ocn.ne.jp>
containers#1809
@isiin isiin force-pushed the feature/add-custom-volumes branch from 0b1c2df to 9225c80 Compare June 24, 2026 15:46
isiin added a commit to isiin/toolbox that referenced this pull request Jun 24, 2026
Per feedback on code style consistency, I have introduced '-V' as the
shorthand for '--volume'. This justifies the use of StringArrayVarP and
improves user experience by providing a consistent CLI interface.

Signed-off-by: isiin <isiin@abeam.ocn.ne.jp>
containers#1809
@isiin isiin force-pushed the feature/add-custom-volumes branch from 9225c80 to 0155b8f Compare June 24, 2026 16:00
isiin added a commit to isiin/toolbox that referenced this pull request Jun 24, 2026
Per feedback on code style consistency, I have introduced '-V' as the
shorthand for '--volume'. This justifies the use of StringArrayVarP and
improves user experience by providing a consistent CLI interface.

Signed-off-by: isiin <isiin@abeam.ocn.ne.jp>
containers#1809
@isiin isiin force-pushed the feature/add-custom-volumes branch from 0155b8f to 11e858e Compare June 24, 2026 16:07
Per feedback on code style consistency, I have introduced '-V' as the
shorthand for '--volume'. This justifies the use of StringArrayVarP and
improves user experience by providing a consistent CLI interface.

Signed-off-by: isiin <isiin@abeam.ocn.ne.jp>
containers#1809
@isiin isiin force-pushed the feature/add-custom-volumes branch from 11e858e to 497eda3 Compare June 24, 2026 16:32
@isiin

isiin commented Jun 24, 2026

Copy link
Copy Markdown
Author

recheck

@isiin

isiin commented Jun 25, 2026

Copy link
Copy Markdown
Author

recheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to mount volumes

1 participant