Is it possible to change the root user password in Docker?
I have the following lines in my alpine docker:
RUN echo “root:Dev123” | chpasswd
RUN adduser appuser -D
by which I expect the followings:
- Change the root user password
- Add a new user to the docker, “appuser”
- Start the docker container with the “appuser”
Steps 2 & 3 go find and I can see that the docker is started with the “appuser” user but it is also possible to run the docker container as “root” like below
docker container run -it --user root myimg:latest sh
without being asked for the root password and by that I assume that it is either not possible to change the password or the docker core somehow knows the new password.
Hope someone knows how to set the password for root.