I was digging into possibilities to manage docker containers remotely and it turns out, it’s not as difficult as you’d imagine. We just need to make a few small changes to access the Docker Engine API.
How to access the Docker Engine API remotely?
When you’re running Ubuntu (16.04+) you have to make a small change in
Open up docker.service
sudo nano /lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock line, and add:
Restart the docker service
sudo systemctl daemon-reload
sudo systemctl restart docker
Verify that it’s working
curl -X GET http://localhost:4243/images/json
And you’re good to go! You can now access the Docker Engine API remotely. This also means you’re in the danger zone. Make sure to put up adequate security!
Leave a Reply