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
593 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,020 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,160 points
257 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
1,516 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,020 points
900 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,020 points
700 views