Skip to content

Instantly share code, notes, and snippets.

@filipechagas
Created July 26, 2022 18:54
Show Gist options
  • Save filipechagas/df73f1ddbb273952ea3982f94953b17d to your computer and use it in GitHub Desktop.
Save filipechagas/df73f1ddbb273952ea3982f94953b17d to your computer and use it in GitHub Desktop.
Configuring a Docker Server for local development with Docker Remote Host API

Configuring a Docker Server for local development with Docker Remote Host API

This assumes both machines, server and client, are on the same network and the port that will be used is open for network connections.

On the server

Assuming you already have docker installed

vi /lib/systemd/system/docker.service

Modify the following line:

ExecStart=/usr/bin/docker daemon -H fd:// -H tcp://0.0.0.0:2375

sudo systemctl daemon-reload

sudo systemctl restart docker.service

Check it's working by running:

curl http://localhost:2375/version

On the client

export DOCKER_HOST="tcp://192.168.2.196:2375"

And that's it. From now on, docker commands on the client will execute on the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment