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,220 points
1,319 views

1 answer to this question.

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'
services:
  example-service:
    image: imagename:latest
answered Aug 24, 2018 by Nilesh
• 7,060 points

Related Questions In Docker

0 votes
1 answer
0 votes
1 answer

How to get the hostname of the manager node in the Docker swarm?

Hi@akhtar, You can find the manager hostname using ...READ MORE

answered Dec 24, 2020 in Docker by MD
• 95,460 points
4,197 views
+2 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
3,979 views
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
• 7,060 points
2,097 views
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
• 7,060 points
1,885 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP