0

I have to virtualize our internal application composed of three components. Each component has its dedicated port. For convenient, I would like to create one Dockercompose with "expose" set with var (expose is depreciated in docker-compose, so can not be used), in order to create three images.

I have created the following

Dockerfile :

FROM centos7
[...]
EXPOSE $EXPOSE_PORT
ENTRYPOINT [ "/entrypoint.sh"]

docker-compose.yml :

version: "3"
services:
image: image1
[...]
environment:
EXPOSE_PORT: "80"
depends_on:
- image2
- image3

image: image2
[...]
environment:
EXPOSE_PORT: "1298"

image: image3
[...]
environment:
EXPOSE_PORT: "1299"

But ports are not properly set when I run 'docker stack deploy -test -c docker-compose.yml', and image1 can not exchange with image2 and image3.

How to deploy stack with dedicated ports ?

Colas06
  • 139
  • 3
  • 8
  • Expose doesn't control the ability of containers to communicate with each other. Please include a [mcve], particularly the compose.yml file, steps you've taken to enable overlay networking, and how you are testing communication between containers. – BMitch May 16 '18 at 11:25
  • See the documentation on expose here: https://docs.docker.com/engine/reference/builder/#expose – BMitch May 16 '18 at 11:28

0 Answers0