Connecting to a container


Connecting to a container

Last updated September 7th, 2018

Containers are able to talk to each other, this is done using a private network between the containers. To make this easier to use, there are host definitions for the linked containers. The name of the container will be the same as the host you connect to and these hosts can be used to connect to the different containers.

For example, from a shell, you are able to connect to mysql using the following:

$ mysql -u example -h mysql57 -p

For more on connecting to databases and mysql hostnames see Connecting to a Database


Here are some examples on how to connect to various containers from a shell.


Let's say you have a Redis 3 container, and you want to connect to it. First you need to make sure that the SSH user only has access to the Redis 3 container, otherwise you wont have access to commands such as redis-cli.

Note: In this example we assume the container name is redis3

To connect, we shell in and run the following command:

$ redis-cli -h redis3


Once again we are assuming the container name is postgres94, and as described above, the SSH user only has access to the Postgres 9.4 container.

Note: The default password for the postgres user is 'password'

To connect, we shell in and run the following command:

$ psql -U postgres -h postgres94
Password for user postgres:
psql (9.4.5)
Type "help" for help.


For more information on how SSH privileges work, please refer to our article on SSH/SFTP user privileges

Can we improve this article? Suggest an improvement to this article.

Suggest an Improvement

Thank you for helping us to improve this Knowledge Base article. Please type your suggestions below:

Still need help? Get in touch with us.

If you aren't able to find the help you need then please send us a question and we can help you further.