I have four images built using docker-compose.yml. I start the container using docker-compose up -d on my local. I have pushed these images to docker hub and pulled from the server where i want to host my site. As of now i start the container by using docker run on 4 of the images. How can i start all the containers as i did in local using docker-compose up in the server.
Any help is really appreciated as i’m novice in this field
Hi There,
You can use docker stack to deploy your services on server using your docker-compose.yml file. Docker stack deploy takes docker-compose as its declarative input to deploy services on sever.
Docker stack deploy -c docker-compose.yml (prefix for your stack)
Note: To use docker stack, first enable swarm mode on docker on your server using ‘docker swarm init’ command.