MECHANICAL
ROCK
MECHANICAL
ROCK

We help companies design, build and deliver cloud-native solutions, leverage data platforms and unlock AI so your systems can run securely, reliably and at scale.

ABOUT

Our StoryImpact PartnersTechnology PartnersOur Work

SERVICES

INDUSTRY SOLUTIONS

LEARN

BlogTrainingEventsVideosPodcast

CONTACT US

Mechanical Rock Pty Ltd

contact@mechanicalrock.io
(+61) 08 9126 9454


Perth Office
Old Cloisters Building
Level 1, 200 St Georges Terrace
Perth, Western Australia 6000

UK Office
4th Floor, 100 Fenchurch St
London EC3M 5JD, UK
Contact Us
Spotify Logo

Ā© Mechanical Rock 2026

<< Back to all Blogs
Networking Between Sibling Docker Containers

Networking Between Sibling Docker Containers

Tim Myerscough1 December 2017

We work inside Docker containers all the time, as our development environment.

As a result, we sometimes want to spin up sibling containers and connect to them.

Example:

In the following example, I want to connect my current container, myproject_dev-env_run_1, started using docker-compose to the myapp container, which was started using the docker command from within the dev-env container:

$ docker ps
CONTAINER ID        IMAGE                      COMMAND              CREATED             STATUS              PORTS                  NAMES
874a13f65926        myapp                      "httpd-foreground"   11 minutes ago      Up 11 minutes       0.0.0.0:8080->80/tcp   myapp
034a8606b4b0        myproject-dev-env:latest   "bash"               37 minutes ago      Up 37 minutes                              myproject_dev-env_run_1
curl http://myapp
curl: (6) Could not resolve host: myapp

šŸ˜ž

However, I can connect the myapp container to my current container network

$ docker network ls
NETWORK ID          NAME                                      DRIVER              SCOPE
...
76a9193ca4b4        myproject_default    bridge              local

Connect the myapp container to my current network docker network connect 76a9193ca4b4 874a13f65926

# curl http://myapp
<html>
<head>
  <Title>Hello World</title>
</head>
<body>
  Hello World!
</body>
</html>

BOOM! 🤘

Docker networking is used by docker-compose under the hood to transparently add all your compose services to a common network.