How to detect a docker daemon port
By default, the docker daemon will use the unix socket unix:///var/run/docker.sock
(you can check this is the case for you by doing a sudo netstat -tunlp
and note that there is no docker daemon process listening on any ports). It's recommended to keep this setting for security reasons but it sounds like Riak requires the daemon to be running on a TCP socket.
To start the docker daemon with a TCP socket that anybody can connect to, use the -H
option:
sudo docker -H 0.0.0.0:2375 -d &
Warning: This means machines that can talk to the daemon through that TCP socket can get root access to your host machine.
Related docs:
http://basho.com/posts/technical/running-riak-in-docker/
https://docs.docker.com/install/linux/linux-postinstall/#configure-where-the-docker-daemon-listens-for-connections
- Prepare extra configuration file. Create a file named
/etc/systemd/system/docker.service.d/docker.conf
. Inside the filedocker.conf
, paste below content:
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
Note that if there is no directory like
docker.service.d
or a file nameddocker.conf
then you should create it.
Restart Docker. After saving this file, reload the configuration by
systemctl daemon-reload
and restart Docker bysystemctl restart docker.service
.Check your Docker daemon. After restarting docker service, you can see the port in the output of
systemctl status docker.service
like/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
.
Hope this may help
Thank you!