I have installed docker (v17.06.2-ce) under CentOS using systemd. Docker works fine and listens to the unix socket. Now i would like to have docker to listen to the Unix socket and to the TCP socket 2375. Since this is an in-house development machine security is no issue.
I scanned the internet found several articles but still got some questions.
My understanding is that I have systemd file (docker.service) which starts the dockerd without any parameters. ExecStart=/usr/bin/dockerd
Then there is the file demon.json here I can list what I will listen to. My question is what to enter here. It could be.
{
"hosts": [ "unix:///var/run/docker.sock",
"tcp://0.0.0.0:2375"
]
}
Or is it something like this for socket activation?
{
"hosts": [ "unix:///var/run/docker.sock",
"fd://"
]
}
Then the second thing I found out is to prepare systemd socket by providing a file docker.sockst like this
[Unit] Description=Docker Socket for the API
PartOf=docker.service
[Socket]
ListenStream=tcp://0.0.0.0:2375
SocketMode=0660
SocketUser=root
SocketGroup=docker
[Install]
WantedBy=sockets.target
But this will define only one TCP socket. According to one article then docker will respond to TCP port but no longer to the unix socket.
It would be nice if someone could point out the details.