I would like to run a daemon on the host and get the containers connect to it. I was thinking I will bind the daemon on the host to 127.0.0.1
and then have something (delegate? or is iptables enough?) forward packets from the IP of docker0
to the daemon. So the questions are
- How do I start something when the docker daemon starts
- What is that something?
I am on Debian 7.
The following questions seem relevant but AFAIK aren't answers:
What I've found instead is -- most daemons are capable of using Unix sockets and you can mount that socket from the host into the container with
-v
. The ancient trick of everything is a file comes very handy. For egdocker run -v /var/run/mysqld/mysqld.sock:/tmp/mysql.sock
. Inside the container you will connect to/tmp/mysql.sock
. Also the same trick works with mounting the directory containing the socket -- this can be used to run X Windows applications within docker without SSH forward: just do-v /tmp/.X11-unix:/tmp/.X11-unix
.