I have a basic Dockerfile:
FROM ubuntu:xenial
USER test
ENTRYPOINT ["/bin/bash"]
For this Dockerfile, I want to be able to create a user without a password, and when the Docker container is run, I want that user to be used, instead of root. When I try to run the container, docker run -it test:1
, I get this error:
docker: Error response from daemon: linux spec user: unable to find user test: no matching entries in passwd file.
How can I create a user in a Dockerfile and have that user be the default user when the container is run interactively?
Add RUN useradd -s /bin/bash user
before the USER directive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With