Docker images are supposed to be immutable, yet when I import one of my images on another machine, it behaves differently.
To reproduce the bug, I will start from a debian-wheezy image built using debootstrap.
I build my image using a Dockerfile:
FROM debian-wheezy RUN apt-get install -y fail2ban RUN rm /var/run/fail2ban/fail2ban.sock
The last command avoids fail2ban from crashing at next start: for some reason, the socket file stays there after installing fail2ban, even if I stop the service manually in the Dockerfile. Fail2ban can not restart if the file is still there.
Launching the image and starting fail2ban will succeed. We can check the content of the /var/run/fail2ban repository:
$ docker build -t test/fail2ban . $ docker run test/fail2ban ls /var/run/fail2ban fail2ban.pid
However, if I export the image and import it to another machine:
$ docker save test/fail2ban > /tmp/fail2ban.tar $ scp /tmp/fail2ban.tar user@machine:/tmp $ ssh user@machine "cat /tmp/fail2ban.tar | docker load" $ ssh user@machine docker run test/fail2ban ls /var/run/fail2ban fail2ban.pid fail2ban.sock
This time the socket file is there, preventing me from starting the service.
Can somebody explain this behaviour and how to fix the problem?
Here are some more informations:
$ uname -a Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u2 x86_64 GNU/Linux $ docker --version Docker version 1.6.0, build 4749651 $ ssh user@machine uname -a Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1 x86_64 GNU/Linux $ ssh user@machine docker --version Docker version 1.6.0, build 4749651