Docker on localhost - bradsorour/notes GitHub Wiki
Here are the steps getting two Spring Boot applications (run in Docker containers) to talk to each other on my local machine.
Build the dockerfile(s)
$ ./mvnw install dockerfile:build
Run the docker 2x containers
$ docker run -p 8080:8080 --name producer1 -t microservice1/restproducer
$ docker run -p 5000:5000 --name consumer1 -t microservice2/restconsumer
Create a user-defined network bridge
(this allows the two local docker containers to communicate with each other)
$ docker network create my-net
Connect the running containers to the user-defined bridge
(this connects an already running container to an already-existing network)
$ docker network connect my-net producer1
$ docker network connect my-net consumer1