phpguru
phpguru

Reputation: 2371

How to create ssh tunnel to dockerfile/mysql container

I am looking for the right syntax to use to create an SSH tunnel (on a non-standard port, eg 3309) that I can use from Mac OS X Yosemite terminal, which will enable me to use Sequel Pro to connect to the mysql container running inside boot2docker.

For example, I tried this,

ssh -L3309:localhost:3306 docker@$(boot2docker ip)

but it asks for [email protected]'s password and I don't think that is needed so I'm assuming that's not quite right.

Thanks!

Upvotes: 5

Views: 4280

Answers (2)

cawhite78
cawhite78

Reputation: 91

If you don't want to tunnel into docker, you can just setup a ssh connection through Sequel pro

Create a new connection in Sequel pro and choose the SSH connection option and follow the instructions below to populate the fields.

Mysql Host:

Issue the command below to get your mysql host

docker inspect --format='{{.NetworkSettings.IPAddress}}' "container id or container name"

If you don't know your container id or name, do docker ps -a, and locate the id or name from the output.

Username, password, database (the db credentials)

SSH Host

Enter boot2docker ip in your terminal to get the host

SSH User

docker

SSH Password

tcuser

Test your connection and after it is successful, save it to your favorites!

Upvotes: 9

cawhite78
cawhite78

Reputation: 91

This might not be what you are looking for you, but the docker password is tcuser (the standard default) which gets you into the boot2docker host.

Upvotes: 0

Related Questions