Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get docker container root's password

Tags:

docker

How can I get docker container root's password?

[root@localhost train02]# docker exec -it jenkins /bin/bash [jenkins@89d5aa94e6ec /]ls /root ls:cannot open directory /root: Permission denied 
like image 482
user2492364 Avatar asked Oct 22 '15 01:10

user2492364


People also ask

What is my docker password?

When you use the docker login command, your credentials are stored in your home directory in . docker/config. json . The password is base64-encoded in this file.

What is Jovyan password?

The user name is jovyan and the password is jupyter .

How do I get root access in docker?

Docker containers are designed to be accessed as root users to execute commands that non-root users can't execute. We can run a command in a running container using the docker exec. We'll use the -i and -t option of the docker exec command to get the interactive shell with TTY terminal access.


1 Answers

If you're using the docker (>=1.7.0), please pass -u option to docker exec:

docker exec -it -u root jenkins /bin/bash 

It'll run /bin/bash as root user.

like image 126
kev Avatar answered Sep 21 '22 12:09

kev