projectatomic / docker

Docker - the open-source application container engine
http://www.docker.com
Apache License 2.0
81 stars 58 forks source link

Don't create source directory while the daemon is being shutdown #328

Closed TomSweeneyRedHat closed 6 years ago

TomSweeneyRedHat commented 6 years ago

Signed-off-by: TomSweeneyRedHat tsweeney@redhat.com

Ported the patch from moby#33330 into this branch. The problem is the /var/run/docker.sock file can with the right conditions and bad timing be created as a directory rather than a link when the daemon is shutting down. Without this change docker would not restart after this timing issue hit until the /var/run/docker.sock directory was removed.

This is the second part, #327 addressed Docker-1.13.1

vi is my friend.

** - Testing:

[root@localhost run]# systemctl start docker
[root@localhost run]# docker run -ti --restart always -v /var/run/docker.sock:/sock alpine
/ # exit
[root@localhost run]# systemctl stop docker
[root@localhost run]# systemctl start docker
[root@localhost run]# docker run -ti --restart always -v /var/run/docker.sock:/sock alpine
/ # exit
[root@localhost run]# systemctl stop docker
[root@localhost run]# systemctl start docker
[root@localhost run]# ls -alF docker.sock
srw-rw----. 1 root root 0 Oct 10 19:47 docker.sock=

From journalctl with the new log entry showing that the error condition is being handled correctly:

Oct 10 19:46:46 localhost.localdomain dockerd-current[4884]: time="2018-10-10T19:46:46.51
TomSweeneyRedHat commented 6 years ago

@runcom tested again, reviewed again, gtg. Thanks again for the cherry-pick thought.

TomSweeneyRedHat commented 6 years ago

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1466479