dockerdocker-compose

How to run docker-compose on remote host?


I have compose file locally. How to run bundle of containers on remote host like docker-compose up -d with DOCKER_HOST=<some ip>?


Solution

  • If you don't need to run docker container on your local machine, but still on the same remote machine, you can change this in your docker setting.

    On the local machine: You can control remote host with -H parameter

    docker -H tcp://remote:2375 pull ubuntu
    

    To use it with docker-compose, you should add this parameter in /etc/default/docker

    On the remote machine

    You should change listen from external adress and not only unix socket.

    See Bind Docker to another host/port or a Unix socket for more details.

    If you need to run container on multiple remote hoste, you should configure Docker Swarm