using docker-compose with docker-swarm can swarm build an image from a dockerfile

0 votes
Can I integrate docker swarm and docker compose to build an image from a dockerfile? I am using a compose file version 2.0.
Jul 8, 2019 in Docker by Namik
• 1,230 points
3,447 views

1 answer to this question.

0 votes

Yes, you could integrate the two of them.Docker-Swarm can build an image from a Dockerfile just like a single-host Docker instance can, but the resulting image only lives on a single node and won’t be distributed to other nodes.

If you want to use Docker Compose to scale the service in question to multiple nodes, build the image, push it to a registry such as Docker Hub, and reference it from docker-compose.yml:

$ docker build -t myusername/web .
$ docker push myusername/web

$ cat docker-compose.yml
web:
  image: myusername/web

$ docker-compose up -d
$ docker-compose scale web=3
answered Jul 8, 2019 by Sirajul
• 59,230 points

Related Questions In Docker

0 votes
1 answer

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

Use docker build to build the image. ...READ MORE

answered Aug 24, 2018 in Docker by Nilesh
• 7,060 points
1,319 views
0 votes
1 answer

how do I create an image from a tar archive in docker?

You can use docker load command inorder to get ...READ MORE

answered Jul 2, 2019 in Docker by Sirajul
• 59,230 points
8,701 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,737 views
0 votes
2 answers

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

You could try this inorder to clean ...READ MORE

answered Aug 6, 2019 in Docker by Sirajul
• 59,230 points
10,730 views
+1 vote
1 answer

What is a docker file? How do I create a docker image with dockerfile?

 A Dockerfile is a script/text configuration file that contains ...READ MORE

answered Jun 7, 2019 in Docker by Sirajul
• 59,230 points
4,548 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