Docker – Administer Docker Server Remotely With Docker Context (Over SSH)

docker logo

Once you have deployed your single, or multiple, Docker server(s) and find Kubernetes a bit much or overkill. You may want to administer your swarm of containers, much in the same manner as kubectl helps administer Kubernetes pods. This is possible with Docker Context.

Here’s how to connect administer your docker runtime(s) remotely using Docker Context, over ssh.

First, make sure you have setup a passwordless and ssh-key based login to your remote server(s) where the docker runtime(s) is hosted.

Second, add one (or several) endpoint:

~$ docker context create remote --description "Remote Endpoint" --docker "host=ssh://user@dockerendpoint"

Use the context, to list running containers remotely for example:

~$ docker --context=remote ps -a

List available contexts:

~$ docker context ls

Poor mans kubectl 👾

Leave a Reply

Your email address will not be published. Required fields are marked *