docker-baseimage-kasmvnc icon indicating copy to clipboard operation
docker-baseimage-kasmvnc copied to clipboard

[BUG] running dind deletes /tmp

Open hgw77 opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

If I run with --env START_DOCKER="true" and --privileged the /tmp dir is empty. That is causing that for instance in KDE the systemsettings no longer working with the error DBus session bus not found

Expected Behavior

Without running dind (--env START_DOCKER="false") I can found in /tmp for instance the dbus session and KDE systemsettings are working without problems

Steps To Reproduce

  1. run the container with --env START_DOCKER="false" and --privileged (tested this with webtop-ubuntu-kde)
  2. check /tmp
  3. run sudo /usr/local/bin/dockerd-entrypoint.sh
  4. check /tmp again

I digged deeper and the /usr/local/bin/dockerd-entrypoint.sh is running on the end the command /usr/local/bin/dind dockerd --host=unix:///var/run/docker.sock If you run this command will result also in the empty /tmp

I checked the dind command, it is a shell script and in this script you will find

# Mount /tmp (conditionally)
if ! mountpoint -q /tmp; then
        mount -t tmpfs none /tmp
fi

When I run mountpoint /tmp after the container was started I get /tmp is not a mountpoint

Thats the reason why the dind script recreates the /tmp

Environment

- OS:
- How docker service was installed:

Docker creation

docker run -d \
  --name=webtop \
  -e PUID=1000 \
  -e PGID=1000 \
  -e START_DOCKER="false" \
  -p 3000:3000 \
  -p 3001:3001 \
  --security-opt seccomp=unconfined `#optional` \
  --privileged \
  --restart unless-stopped \
  lscr.io/linuxserver/webtop-ubuntu-kde:latest

Container logs

nothing to see here

hgw77 avatar Aug 01 '24 08:08 hgw77

Hey, I guess I found a solution?

After creating this issue and thinking through the problem again I searched about tmpfs and /tmp in docker containers and per default (for performance reasons) in a docker container /tmp is a normal directory. But it is possible to change that behavior.

use --tmpfs /tmp in the docker command and /tmp is mounted with tmpfs and this is solving the problem that dind mounts /tmp with tmpfs and overrides the local /tmp

maybe it's a good idea to mention this somewhere in the README.md

hgw77 avatar Aug 01 '24 09:08 hgw77

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

LinuxServer-CI avatar Aug 31 '24 17:08 LinuxServer-CI

This issue is locked due to inactivity

github-actions[bot] avatar Nov 29 '24 17:11 github-actions[bot]