I'm using a Docker image which was built using the USER command to use a non-root user called dev
.
Inside a container, I'm "dev", but I want to edit the /etc/hosts
file.
So I need to be root. I'm trying the su command, but I'm asked to enter the root password.
What's the default root user's password inside a Docker container?
Eventually, I decided to rebuild my Docker images, so that I change the root password by something I will know.
RUN echo 'root:Docker!' | chpasswd
or
RUN echo 'Docker!' | passwd --stdin root
I tried this but it does not work on my CentOS 6 based docker. Does this command work on CentOS based docker?