docker / for-linux

Docker Engine for Linux
https://docs.docker.com/engine/installation/
756 stars 85 forks source link

Error when mounting a unionfs mountpoint inside docker container #936

Open goodevilgenius opened 4 years ago

goodevilgenius commented 4 years ago

This is somewhat similar to an issue reported on the docker/for-win repo (https://github.com/docker/for-win/issues/710), but I had this issue on Linux.

I had a folder on my host, which was a unionfs-fuse mountpoint. I wanted to mount this folder into a docker container.

Expected behavior

Should be able to mount a folder that is, itself, a unionfs mountpoint within a docker image.

Actual behavior

error while creating mount source path

Steps to reproduce the behavior

unionfs folder1:folder2 union-folder
cd union-folder
# A docker-compose.yml is in the folder
docker-compose up

My docker-compose.yml contains:

version: '3'
services:
  web:
    image: yiisoftware/yii2-php:7.2-apache
    volumes:
      - .:/app
    ports:
      - 80:80
    environment:
      YII_ENV: debug
      PHP_USER_ID: 1000

I get this error:

ERROR: for union-folder_web_1  Cannot start service web: error while creating mount source path '/path/to/union-folder': mkdir /path/to/union-folder: file exists

Output of docker version:

Docker version 19.03.6, build 369ce74a3c

Output of docker info:

Client:
 Debug Mode: false

Server:
 Containers: 20
  Running: 3
  Paused: 0
  Stopped: 17
 Images: 19
 Server Version: 19.03.6
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 35bd7a5f69c13e1563af8a93431411cd9ecf5021
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.3.0-28-generic
 Operating System: Linux Mint 19.3
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.43GiB
 Name: toil-trouble
 ID: XV6Z:CGZP:7V7X:QNTJ:XIK6:Y55B:Y5Q5:4YQZ:VD6L:KXYL:HCPE:KO72
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No swap limit support
wickeduk commented 4 years ago

Same issue here this time with encfs (also fuse)

Suspect it's a docker and fuse problem

ERROR: for mq Cannot start service mq: error while creating mount source path '/home/dav/work/dec/code/...[client and project obscured]': mkdir /home/dav/work/dec: file exists

This is important as I am maintaining client source code and in case of laptop theft I want to keep the code in an encrypted area.

This issue hasn't been looked or commented on since Feb 18 - is anyone bothered?

docker-19.03.11_ce-lp152.1.1.x86_64

on openSuSE.

wickeduk commented 4 years ago

Raised https://github.com/docker/for-linux/issues/1090 for more general docker/fuse - reused your testcase.

wickeduk commented 4 years ago

See comments on my issue, using --public with encfs solves it, maybe there is something similar for unionfs and allowing other users?