I want to open up TCP to the docker daemon so that Jenkins can build containers against it.
I'm getting lots of info about how to do this. Hoping to get the best method.
Goals of dockerd:
- Listen over TCP and local unix socket.
- Persistence through reboots.
- Host-Specific Authorization for security. Only allow access from specific host. (could be done w/ iptables)
This is an Ubuntu Xenial host.
Current Dockerd Run Info:
root@host:# ps -ef |grep dockerd
root 1171 1 0 17:51 ? 00:00:04 /usr/bin/dockerd -H fd://
Docker config snippet (/etc/init/docker.conf):
post-start script
DOCKER_OPTS=
DOCKER_SOCKET=
if [ -f /etc/default/$UPSTART_JOB ]; then
. /etc/default/$UPSTART_JOB
fi
if ! printf "%s" "$DOCKER_OPTS" | grep -qE -e '-H|--host'; then
DOCKER_SOCKET=/var/run/docker.sock
else
DOCKER_SOCKET=$(printf "%s" "$DOCKER_OPTS" | grep -oP -e '(-H|--host)\W*unix://\K(\S+)' | sed 1q)
fi
if [ -n "$DOCKER_SOCKET" ]; then
while ! [ -e "$DOCKER_SOCKET" ]; do
initctl status $UPSTART_JOB | grep -qE "(stop|respawn)/" && exit 1
echo "Waiting for $DOCKER_SOCKET"
sleep 0.1
done
echo "$DOCKER_SOCKET is up"
fi
end script
How should I go about this?
Best Answer
Found an applicable and clean answer on this blog
Steps:
Edit This file:
Look for the existing
ExecStart
line:Add your desired config:
Restart:
After that, my daemon was listening on 3272 and was ready to go!