osrf / rocker

A tool to run docker containers with overlays and convenient options for things like GUIs etc.
Apache License 2.0
555 stars 70 forks source link

Add option to not pass host user $SHELL to container when using --user? #183

Closed rcywongaa closed 2 years ago

rcywongaa commented 2 years ago

I use zsh in my host environment but zsh isn't installed in my container. It seems with --user, rocker automatically sets the container shell to use the host user shell

https://github.com/osrf/rocker/blob/28a8e796ed7fe9b450a80a6385b3a2f56e85e3d0/src/rocker/templates/user_snippet.Dockerfile.em#L19

This causes the following warning to pop up in various places

Warning: missing or non-executable shell '/bin/zsh'

Given that a container usually has a stripped down version of the host environment, it doesn't seem like a good idea to assume the container will have/use the same shell as the host.

Should there be an option to disable this shell setting?

tfoote commented 2 years ago

Yeah, an option like --user-override-shell might make sense similar to how you can override the username

https://github.com/osrf/rocker/blob/28a8e796ed7fe9b450a80a6385b3a2f56e85e3d0/src/rocker/extensions.py#L233-L236

rcywongaa commented 2 years ago

Cool! PR: https://github.com/osrf/rocker/pull/185

Should the default behavior (in the absence of --user-override-shell) be changed to use the container's default shell then, i.e. only use a different shell when explicitly provided?

The rationale would be it's perhaps more intuitive that the container uses it's default shell and allows user to override, rather than the container uses the user shell and the user has to figure out the container default shell if user wants to use the default

Perhaps the arg could be --use-user-shell to better convey that the absence of the arg (i.e. the default behavior) is to use the container default shell