1

I am building a web app using docker swarm.

Manager machine will have database and load balancer. Next I have two pieces of software: tornado server, which acts as middle layer between user and node server. They should always be served together. And one tornado server should always talk to one node server.

I want containers to be as isolated as possible (in order to keep scalability), but how I ensure that kind of communication?

Right now my approach is to build two separate images - one for tornado and one for node and then create muli-stage container which connects them both. I do not feel this is optimal as I have to run two start commands in CMD.

What is preferable solution? Can you force docker to couple images (e.g. without specifying IPs)?

Paweł
  • 81
  • 9

1 Answers1

0

There is a link feature in docker compose files: https://docs.docker.com/compose/compose-file/#links. But recently Docker marked it as deprecated and suggests using user-defined networks: https://docs.docker.com/network/.

P.S: Also pay attention to the notes:

- If you define both links and networks, services with links between them must share at least one network in common to communicate.

- This option is ignored when deploying a stack in swarm mode with a (version 3) Compose file.
Mepla
  • 438
  • 4
  • 16