0

I have Debian 10 virtual machine. And I want to be able to connect to the docker API from another host. I can connect to docker from other host if I start docker deamon from console

dockerd -H unix:///var/run/docker.sock -H tcp://192.168.3.157

If I try to configure /etc/docker/daemon.json like

{
  "hosts": ["unix:///var/run/docker.sock", "tcp://192.168.3.157"]
}

The command systemctl start docker fails. The command systemctl status docker have next output

● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2019-11-02 11:32:26 MSK; 1min 10s ago
     Docs: https://docs.docker.com
  Process: 868 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 868 (code=exited, status=1/FAILURE)

Nov 02 11:32:24 debian-for-docker systemd[1]: Failed to start Docker Application Container Engine.
Nov 02 11:32:26 debian-for-docker systemd[1]: docker.service: Service RestartSec=2s expired, scheduling restart.
Nov 02 11:32:26 debian-for-docker systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Nov 02 11:32:26 debian-for-docker systemd[1]: Stopped Docker Application Container Engine.
Nov 02 11:32:26 debian-for-docker systemd[1]: docker.service: Start request repeated too quickly.
Nov 02 11:32:26 debian-for-docker systemd[1]: docker.service: Failed with result 'exit-code'.
Nov 02 11:32:26 debian-for-docker systemd[1]: Failed to start Docker Application Container Engine.
Nov 02 11:32:53 debian-for-docker systemd[1]: docker.service: Start request repeated too quickly.
Nov 02 11:32:53 debian-for-docker systemd[1]: docker.service: Failed with result 'exit-code'.
Nov 02 11:32:53 debian-for-docker systemd[1]: Failed to start Docker Application Container Engine.

How should I configure the /etc/docker/daemon.json to make my deamon start properly?

Alexey Vashchenkov
  • 233
  • 1
  • 4
  • 12

1 Answers1

1

I have found the answer. It's here Unable to start docker after configuring hosts in daemon.json I have created the file /etc/systemd/system/docker.service.d/override.conf with content

# Disable flags to dockerd, all settings are done in /etc/docker/daemon.json
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd

And then I restarted the service systemctl daemon-reload; systemctl restart docker

Alexey Vashchenkov
  • 233
  • 1
  • 4
  • 12