Networking Between Multiple Docker-Compose Projects

Networking Between Multiple Docker-Compose Projects

Networking Between Multiple Docker-Compose Projects

Docker Networks

My test directory. Each project is in its own directory to be sure there are different networks created.My test directory. Each project is in its own directory to be sure there are different networks created.

Manually Creating the Docker Network

create the network and check it existscreate the network and check it exists

Declare the network as externalDeclare the network as external

pinging and sending requests to the other docker-compose projectpinging and sending requests to the other docker-compose project

Making it Easier

just use the name of the default network from the first projectjust use the name of the default network from the first project

Tools To Help

  • docker network create
  • docker network ls
  • docker inspect [container name]
  • netcat

TL;DR

  • connecting multiple docker-networks can get tricky
  • by either creating a network or using the default network created, we can connect them using external in the filename