Different results with docker run and docker-compose?

Viewed 140

I'm using this image to mount an unionfs filesystem. When I run the container with docker run, it works perfectly, but when I put the same conditions into docker-compose, it doesn't work. It seem to be an issue with the environmental variable (I suspect).

docker-compose config:

  unionfs:
    container_name: unionfs
    image: meyay/unionfs-mount:alpha
    environment:
      - TZ=Europe/Berlin
      - PUID=1000
      - GUID=1000
      - READ_ONLY_DIR="/read-only/m/ro"
      - READ_WRITE_DIR="/read-write/m/rw"
    privileged: true
    volumes:
      - /home/ubuntu/sshfs:/read-write:slave
      - /mnt/gdrive:/read-only:slave
      - /mnt/unionfs/tvs:/merged:shared

docker-compose up gives me this error in the container: Failed to open /run/s6/services/unionfs/"/read-write/m/rw"/: No such file or directory. Aborting!

If I run the same image with docker run:

docker run --rm \
--name unionfs \
-e TZ="Europe/Berlin" \
-e PUID=1000 \
-e GUID=1000 \
-e READ_ONLY_DIR="/read-only/m/ro" \
-e READ_WRITE_DIR="/read-write/m/rw" \
--privileged \
-v /home/ubuntu/sshfs:/read-write:slave \
-v /mnt/gdrive:/read-only:slave \
-v /mnt/unionfs/tvs:/merged:shared \
meyay/unionfs-mount:alpha

then the unionfs mount will be mounted successfully. Is there any reason why is this happening? They are both identical, right?

1 Answers

The problem here are the quotes, which are treated differently, as you specify the variables in a yaml-file.

You need to write it like this:

  unionfs:
    container_name: unionfs
    image: meyay/unionfs-mount:alpha
    environment:
      - TZ=Europe/Berlin
      - PUID=1000
      - GUID=1000
      - "READ_ONLY_DIR=/read-only/m/ro"
      - "READ_WRITE_DIR=/read-write/m/rw"
    privileged: true
    volumes:
      - /home/ubuntu/sshfs:/read-write:slave
      - /mnt/gdrive:/read-only:slave
      - /mnt/unionfs/tvs:/merged:shared

Refer to this question as well.
And I just found this issue on GitHub.

Related