Docker Swarm- Build image only when stack deployed from manager node

0 votes
I'm trying to deploy a stack of services in a swarm in a local machine. i want the image to be built only when i deploy or run the stack from manager node.

Is there a way to acheive this?
Aug 24, 2018 in Docker by lina
• 8,100 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Use docker build to build the image. The thing with docker swarm is that it doesn't work with tags instead it uses the image id while executing a stack deploy.

docker build -t imagename --no-cache .

You can use this image on your Docker Compose file like the following:

version: '3'
    image: imagename:latest
answered Aug 24, 2018 by Nilesh
• 6,900 points

Related Questions In Docker

0 votes
1 answer

Docker config to edit Node code when run

What you can do is pass environment ...READ MORE

answered Jun 16, 2018 in Docker by shubham
• 6,480 points
0 votes
1 answer

build context for docker image very large

The Docker client sends the entire "build ...READ MORE

answered Aug 1, 2018 in Docker by Kalgi
• 35,750 points
0 votes
1 answer

Managers information from workers - Docker swarm

As of now there's no way to ...READ MORE

answered Oct 8, 2018 in Docker by Kalgi
• 35,750 points
0 votes
1 answer

How do I force Docker for a clean build of an image ?

You can try the following step: You have ...READ MORE

answered Sep 7, 2018 in Docker by Damon Salvatore
• 5,250 points
0 votes
1 answer
+5 votes
7 answers

Docker swarm vs kubernetes

Swarm is easy handling while kn8 is ...READ MORE

answered Aug 27, 2018 in Docker by Mahesh Ajmeria
0 votes
1 answer

Docker-Swarm: Join a docker-swarm from another subnet

You need the following ports open between ...READ MORE

answered Aug 22, 2018 in Docker by Nilesh
• 6,900 points
0 votes
1 answer

swarm manager does not connect to nodes docker daemons on AWS

You first need to ssh into the ...READ MORE

answered Aug 24, 2018 in Docker by Nilesh
• 6,900 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.