Skip to content
Ricky
English

Search

Searching… No matching pages. Matching pages are listed below. Search is unavailable. Please try again.

How to deploy on remote Docker hosts with docker-compose

  • Ricky Lin
  • 1 minute
On this page
Manual deployment by copying project files, install docker-compose and running it
$ scp -r hello-docker user@remotehost:/path/to/src
$ ssh user@remotehost
$ pip install docker-compose
$ cd /path/to/src/hello-docker
$ docker-compose up -d
Using DOCKER_HOST environment variable to set up the target engine
$ cd hello-docker
$ DOCKER_HOST="ssh://user@remotehost" docker-compose up -d
Using docker contexts
$ docker context create remote ‐‐docker "host=ssh://user@remotemachine"
remote
Successfully created context "remote"

$ docker context ls
NAME      DESCRIPTION            DOCKER ENDPOINT    KUBERNETES ENDPOINT     ORCHESTRATOR
default * Current DOCKER_HOST…   unix:///var/run/docker.sock                swarm
remote                           ssh://user@remotemachine

$ cd hello-docker
$ docker-compose ‐‐context remote up -d