Clean up /tmp in container-init

I ran into a problem where the container does not start after 10 startups.

The reason for this is `/tmp/.X10-lock` file are not deleted when running `docker stop`.
On next `docker-start`, `/tmp/.X11-lock` is allocated instead.
This keeps going until `/tmp/.X19-lock` and from that it gives up.

Another workaround is to use `--tmpfs` in `docker run`.
But not all users always use it.
This commit is contained in:
Thai Pangsakulyanont
2020-10-14 01:35:09 +07:00
committed by GitHub
parent 6efb24389f
commit 8123a21f3e

View File

@@ -1,5 +1,11 @@
#!/bin/sh
# Clean up /tmp, just in case there is some leftover files from previous run and `--tmpfs` is not specified.
# Without this cleanup or `--tmpfs`, the container will no longer start after 10 startups.
rm -rf /tmp
mkdir /tmp
chmod a+rw /tmp
set -eu
# Create additional groups