Skip to content

Instantly share code, notes, and snippets.

@avli
Last active July 26, 2018 10:10
Show Gist options
  • Save avli/5f517ad84018821750c3d988be4dc5e3 to your computer and use it in GitHub Desktop.
Save avli/5f517ad84018821750c3d988be4dc5e3 to your computer and use it in GitHub Desktop.
Docker Interaction Between Stacks

Docker Interaction Between Stacks

First create an overlay network:

docker network create -d overlay uber-net

Now deploy two stacks:

docker stack deploy -c docker-compose-1.yml foo
docker stack deploy -c docker-compose-2.yml bar

The configs are included.

Connect to the foo service:

docker exec -it foo_foo.1.xxx sh

Try to ping the bar service from the container:

ping bar

Both bar and bar_bar work for me.

References

The article that helped me with the issue.

version: '3'
services:
foo:
image: alpine:latest
command: sleep 10000
networks:
default:
external:
name: uber-net
version: '3'
services:
bar:
image: alpine:latest
command: sleep 10000
networks:
default:
external:
name: uber-net
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment