docker-machine boot2docker root password
Asked Answered
K

4

55

Haven't found an answer anywhere... I created a VM (boot2docker) using docker-machine. I need to edit some files using root.

What is the root password in boot2docker?

Kingship answered 18/9, 2015 at 8:9 Comment(6)
have you tried this: tcuser ?Decennary
yes, but wrong passwordKingship
Answered here: #24286507Hollyanne
user: docker and pwd: tcuser then sudoAdvertisement
@Advertisement that works, but where does that information come from?Illusion
Nevermind, the reference is boot2docker README, as said in hereIllusion
O
70

If you only have a single docker machine, you simply do:

$ docker-machine ssh

If you have multiple machines, you need to find your "machine name" first:

$ docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
default   *        virtualbox   Running   tcp://192.168.99.101:2376           v1.10.2 

From the above, you can see that default is the name of your machine and you can ssh as follows:

$ docker-machine ssh default

When you're in, it's a simple case of sudo-ing to root

docker@default:~$ sudo -i
Boot2Docker version 1.10.2, build master : 611be10 - Mon Feb 22 22:47:06 UTC 2016
Docker version 1.10.2, build c3959b1
root@default:~# 

Edited: Also, as @MediaVince mentioned you can use the following credentials:

user: docker

pwd: tcuser

Outbid answered 8/3, 2016 at 11:4 Comment(3)
why does -i work ? I know it means "simulate initial login", but what is the exact mechanism ?Disney
This doesn't actually answer the user's question. The answer was in his question's comment.Eastward
Sorry for the late reply. The -i executes a login shell, similar to the user login in. The manual includes a more complete explanation: Run the shell specified by the target user's password database entry as a login shell. This means that login-specific resource files such as .profile or .login will be read by the shell. If a command is specified, it is passed to the shell for execution via the shell's -c option. If no command is specified, an interactive shell is executed.Outbid
H
31

just type

$ docker-machine ssh your_environment

and then to be root

$ sudo -i

hope it helps

Hike answered 23/9, 2015 at 9:43 Comment(1)
why does -i work ? I know it means "simulate initial login", but what is the exact mechanism ?Disney
G
21

Login via ssh as docker user:

$ ssh docker@<docker-machine-ip>

Password: tcuser

Then you can change on root user, just run sudo su root

Gasket answered 15/11, 2017 at 12:8 Comment(1)
This is also documented at github.com/boot2docker/boot2docker/blob/master/README.mdJ
K
0

Ok the key was not to do "su root" but rather "su sudo". It then doesn't ask for root password.

Kingship answered 18/9, 2015 at 9:8 Comment(1)
For me it was rather sudo su. su sudo gives su: unknown user sudoOctarchy

© 2022 - 2024 — McMap. All rights reserved.