I have such a file with docker-compose.yml :

 version: '3' services: web: build: . command: service nginx start ports: - "35001:80" 

He collects everything correctly, but I cannot understand how to properly deploy to a remote machine.

Here are all the questions:

  • Where do I need to specify the hosts and ports for ssh connection?

  • What settings should be on the remote machine?

  • How do I run a container with the -d and --name flags through docker-compose so that the container will immediately begin to perform its duties?

The official documentation on the example of Django did not find the answers to their questions.

    1 answer 1

    docker-compose python is a utility for building docker containers that allows you to run several containers at the same time using a single configuration file for the entire stack of services needed by your application.

    i.e., you need to manually connect to the server, install the docker, copy your compose file to the server, and docker-compose up -d on the server

    (small tutorial http://video4text.com/en/K4H0_xdMvPY.html )

    • And how is it usually all deploitsya? - faoxis
    • there are 2a variants 1) if you need to wrap up some of your projects (web server), then you put the docker-compose file in the project's git repository after on the server git clone my_project && cd my_project && docker-compose up -d * after reboot server containers will start automatically - finvan71
    • 2) there is still an opportunity to create an image based on the created container and save it to the docker hub (for public images for free); and if you need to automate server configuration via ssh, then use fabric scripts; (some other cloud providers allow you to create a server based on the docker-compose script) - finvan71
    • I usually add a dockerfile, docker-compose, to the repository with the project (if fabric is needed, then the fabric) —to make it myself, or the customer could easily deploy the project to the server; - finvan71
    • And why, after a reboot, will the containers start automatically? After all, docker-compose not a demon. - faoxis