From 80c126244b78dbe217e7e7769aedea7f9b0a8952 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Mon, 8 Jan 2018 20:18:38 +0200 Subject: [PATCH] Added post on enabling docker TCP socket with Systemd socket activation. --- content/docker_tcp_socket.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 content/docker_tcp_socket.rst diff --git a/content/docker_tcp_socket.rst b/content/docker_tcp_socket.rst new file mode 100644 index 0000000..b7436ae --- /dev/null +++ b/content/docker_tcp_socket.rst @@ -0,0 +1,22 @@ +Bind dockerd to a TCP port +########################## + +:date: 2018-01-08 +:summary: Bind dockerd to a TCP port + +On a modern system (one running Systemd) when installing Docker, the +:code:`dockerd` daemon is run using Systemd' socket activation. By default the +socket is :code:`/var/run/docker.sock`. If you want to connect to a remote +machine over TCP, the obvious thing to do is to create +:code:`/etc/docker/daemon.json` and set the :code:`hosts` list there. But that +will conflict with the command line flags for socket activation. The correct way +is to override Systemd' socket activation config. Here's how (all command are as +:code:`root`): + +.. code:: shell + + mkdir -p /etc/systemd/system/docker.socket.d + echo '[Socket]' > /etc/systemd/system/docker.socket.d/tcp.conf + echo 'ListenStream=2375' >> /etc/systemd/system/docker.socket.d/tcp.conf + systemctl daemon-reload + systemctl restart docker -- GitLab