From 8123a21f3e5e31ab4d0729e2b14ebd34642819c7 Mon Sep 17 00:00:00 2001 From: Thai Pangsakulyanont Date: Wed, 14 Oct 2020 01:35:09 +0700 Subject: [PATCH] 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. --- scripts/bin/container-init | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/bin/container-init b/scripts/bin/container-init index df05f11..4180654 100755 --- a/scripts/bin/container-init +++ b/scripts/bin/container-init @@ -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