![Toca free](https://cdn2.cdnme.se/5447227/9-3/18_64e61dfc9606ee7f722fb462.png)
![docker centos 7 docker centos 7](https://img.youtube.com/vi/LvBP2AIu0d8/0.jpg)
For exceptional troubleshooting sessions, you can always access the container from the Docker host with "docker attach" or "docker exec". A container should implement one task and effectively never need to be logged into.
![docker centos 7 docker centos 7](https://www.maquinasvirtuales.eu/wp-content/uploads/2017/04/Instalar-Docker-centos-7.jpg)
(3): Your proposed way with passwd is fair enough, but implementing a fixed password into a container feels wrong for me anyway. In any case, you could derive in turn from that image and set yet another root password. If that Dockerfile is not available I'd personally question that quality of the image at large, since you never know what else might be baked into the image. That way you can look up if and which password he set.
![docker centos 7 docker centos 7](https://img.php.cn/upload/article/202011/25/2020112516135766393.jpg)
(2): If someone derives from a base image, try to get the Dockerfile for that. But this is a rare usecase, mostly used for first steps into containers. You could set then interactively a new root password with passwd. If you run docker run -it centos you start a new container and are inside it immediately as root. (1): I don't know, but that does not matter.
![Toca free](https://cdn2.cdnme.se/5447227/9-3/18_64e61dfc9606ee7f722fb462.png)