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
40 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
• 6,900 points

Related Questions In Docker

0 votes
1 answer
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,890 points
23 views
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
• 39,310 points
2,148 views
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
• 39,310 points
24 views
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
981 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
• 6,900 points
170 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
• 6,900 points
74 views