Start
# init docker daemon
$ sudo vim /etc/docker/daemon.json
{
"debug": true,
"tls": false,
"hosts":["tcp://0.0.0.0:2375","unix:///var/run/docker.sock"]
}
$ sudo dockerd
Refer to https://docs.docker.com/engine/reference/commandline/dockerd/
Setup Docker Daemon for Remote Connection
By default, Docker runs through a non-networked UNIX socket. It can also optionally communicate using SSH or a TLS (HTTPS) socket.
# how to find the path of daemon.json
$ ps auxww | grep docker
root 921 0.0 2.0 1570256 82092 ? Ssl 17:06 0:07 dockerd --group docker --exec-root=/run/snap.docker --data-root=/var/snap/docker/common/var-lib-docker --pidfile=/run/snap.docker/docker.pid --config-file=/var/snap/docker/1767/config/daemon.json
$ sudo vim /var/snap/docker/1767/config/daemon.json
{
"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]
}
# restart the Dokcer Daemon
$ sudo snap restart docker.dockerd
# or
$ sudo systemctl restart docker
# test your daemon's port
$ netstat -an | grep LISTEN | grep 2375
# or
$ docker --debug --host tcp://localhost:2375
# view logs
$ sudo snap logs docker.dockerd
Default Path of Config File
To configure the Docker daemon using a JSON file, create a file at /etc/docker/daemon.json
on Linux systems, or C:\ProgramData\docker\config\daemon.json
on Windows. On MacOS go to the whale in the taskbar > Preferences > Daemon > Advanced.
The default location of the configuration file on Linux is /etc/docker/daemon.json
. The --config-file
flag can be used to specify a non-default location.
...