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 in Docker by Namik
• 1,200 points
192 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 by Sirajul
• 19,670 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
• 6,900 points
40 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 in Docker by Sirajul
• 19,670 points
29 views
0 votes
1 answer
0 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
• 56,520 points
136 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 in Docker by Sirajul
• 19,670 points
821 views
0 votes
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 in Docker by Sirajul
• 19,670 points
274 views