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 ?