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
The compose file serves both tools: docker-compose
cli, and docker stack
cli. the "build" options work in docker-compose
but are ignored by stack commands, and the "deploy" options work in stack commands but are ignored by docker-compose
.
Swarm is not designed to build your images for you. It assumes you're images are available in a image registry. Multiple nodes in a Swarm can't share images with each other, so a registry (either remote or running on the Swarm itself) is the only way they can all ensure they can pull the same exact image.
So the typical example is to either have Docker Hub auto-build your images based on code commits, or have your CI/CD platform build the images and push to a registry. Then your stack deploy
commands will pull the proper image from that registry.