docker-alpine icon indicating copy to clipboard operation
docker-alpine copied to clipboard

/var/run symlinked to /run in 3.7 image

Open kinghuang opened this issue 6 years ago • 2 comments

The alpine:3.7 image has a symlink from /var/run to /run, whereas 3.6 and 3.5 did not. Is this intentional? I can't find any notes about it.

The difference threw me off in images like nginx:1.13.9-alpine, which just updated from Alpine Linux 3.5 to 3.7 as its base. I run nginx containers as read only and mount a tmpfs volume at /var/run. This broke with the symlink.

alpine:3.7

/ # ls -al /var
total 44
drwxr-xr-x   11 root     root          4096 Jan  9 19:37 .
drwxr-xr-x    1 root     root          4096 Mar 15 23:23 ..
drwxr-xr-x    4 root     root          4096 Jan  9 19:37 cache
dr-xr-xr-x    2 root     root          4096 Jan  9 19:37 empty
drwxr-xr-x    5 root     root          4096 Jan  9 19:37 lib
drwxr-xr-x    2 root     root          4096 Jan  9 19:37 local
drwxr-xr-x    3 root     root          4096 Jan  9 19:37 lock
drwxr-xr-x    2 root     root          4096 Jan  9 19:37 log
drwxr-xr-x    2 root     root          4096 Jan  9 19:37 opt
lrwxrwxrwx    1 root     root             4 Jan  9 19:37 run -> /run
drwxr-xr-x    3 root     root          4096 Jan  9 19:37 spool
drwxrwxrwt    2 root     root          4096 Jan  9 19:37 tmp

alpine:3.6

/var # ls -al /var
total 48
drwxr-xr-x   12 root     root          4096 Jan  9 19:36 .
drwxr-xr-x    1 root     root          4096 Mar 15 23:18 ..
drwxr-xr-x    4 root     root          4096 Jan  9 19:36 cache
dr-xr-xr-x    2 root     root          4096 Jan  9 19:36 empty
drwxr-xr-x    5 root     root          4096 Jan  9 19:36 lib
drwxr-xr-x    2 root     root          4096 Jan  9 19:36 local
drwxr-xr-x    3 root     root          4096 Jan  9 19:36 lock
drwxr-xr-x    2 root     root          4096 Jan  9 19:36 log
drwxr-xr-x    2 root     root          4096 Jan  9 19:36 opt
drwxr-xr-x    2 root     root          4096 Jan  9 19:36 run
drwxr-xr-x    3 root     root          4096 Jan  9 19:36 spool
drwxrwxrwt    2 root     root          4096 Jan  9 19:36 tmp

kinghuang avatar Mar 15 '18 23:03 kinghuang

Yes, this was intentional because many applications are now using /run instead of /var/run to comply with FHS 3.0. Accordin FHS 3.0, it is perfectly valid to implement /var/run as a symlink to /run.

Does it work if you mount /run as tmpfs instead?

ncopa avatar Mar 26 '18 10:03 ncopa

I had a similar problem because I was mounting /var/run/postgresql/ to share unix sockets between containers. Fixed by moving directly to /var/postgresql/.

tcorbettclark avatar Dec 09 '18 18:12 tcorbettclark