Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to change root shell in Dockerfile

I am writing a Dockerfile to customize the parrotsec/security container to better suit my preferences, and I’d want zsh as the default shell of root. I tried using

RUN chsh -s /usr/bin/zsh

as well as

RUN usermod --shell /usr/bin/zsh root

but after building the image and running it the shell for the root user remains bash.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I believe you’ll need to add an ENTRYPOINT to your Dockerfile. If you run a docker inspect <image> you’ll see an Entrypoint entry in the output.

See Docker Spawn a shell as a user instead of root which seems pretty closely related to your situation.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading