We have created a docker compose file with multiple services. The images for these services are built in runtime using \'build\' configuration option. The corresponding Dockerfi
Short answer is, you can not use the build command with docker stack deploy.
From the docs:
Note: The
docker stackcommandbuildoption is ignored when deploying a stack in swarm mode with a (version 3) Compose file. Thedocker stackcommand accepts only pre-built images.
An alternative is to build the docker image before deploying the your swarm cluster.
Use the docker build command to create the docker image; Push the created image to a (public or private) docker registry; and reference it in your docker compose file.