2

Enable TCP port 2375 for external connection to Docker

 1 year ago
source link: https://gist.github.com/styblope/dc55e0ad2a9848f2cc3307d4819d819f
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

edisonthk commented on Oct 7, 2020

edited

working on centos-release-7-8.2003.0.el7.centos.x86_64 Docker version 19.03.13, build 4484c46d9d docker-compose version 1.27.0, build 980ec85b

This something I've tried as well and ran in to a few issues creating /etc/systemd/system/docker.service.d/override.conf, I am running Debian 10 and installed (and updated) docker using the script provided in the documentation. (Install using the convenience script)

After reloading the systemd daemon docker still failed to start, going to the log I noticed the following line: (getting the last few lines of the log sudo tail -n 100 /var/log/daemon.log

Oct  8 16:40:16 docker-host systemd[1]: Starting Docker Application Container Engine...
Oct  8 16:40:16 docker-host dockerd[675]: unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file: hosts: (fro
m flag: [fd://], from file: [tcp://0.0.0.0:2375 unix:///var/run/docker.sock])
Oct  8 16:40:16 docker-host systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Oct  8 16:40:16 docker-host systemd[1]: docker.service: Failed with result 'exit-code'.
Oct  8 16:40:16 docker-host systemd[1]: Failed to start Docker Application Container Engine.
Oct  8 16:40:18 docker-host systemd[1]: docker.service: Service RestartSec=2s expired, scheduling restart.
Oct  8 16:40:18 docker-host systemd[1]: docker.service: Scheduled restart job, restart counter is at 2.
Oct  8 16:40:18 docker-host systemd[1]: Stopped Docker Application Container Engine.

To get this to work I adding hosts to /etc/docker/daemon.json and editing /lib/systemd/system/docker.service (running sudo systemctl status docker.service reported the daemon being loaded from there) where I removed host provided in the start:

# Replacing this line:
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

# With this line:
ExecStart=/usr/bin/dockerd --containerd=/run/containerd/containerd.sock

After which reloading the systemd daemon and restarting docker worked as a charm.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK