Closed pfalcon closed 4 years ago
Should we add a sudo mkdir -p /var/lib/lava/dispatcher/tmp
into the Makefile maybe as part of install:
target?
@galak: Good thinking. But now I need to test what ownership/permission would work. Locally I have:
$ ls -ld /var/lib/lava/dispatcher/tmp/
drwxr-xr-x 5 pfalcon pfalcon 4096 Jun 26 12:59 /var/lib/lava/dispatcher/tmp/
(The dir was apparently created "long ago".)
I have:
[galak@lava2 ~]$ ls -lstd /var/lib/lava/dispatcher/tmp/
4 drwxr-xr-x. 2 root root 4096 Jun 25 14:25 /var/lib/lava/dispatcher/tmp/
@galak, So, I just wanted to see what happens if the dir doesn't exist, moved away my current /var/lib/lava as /var/lib/lava.1, and did "make" (i.e. docker-compose up). What I see is that new dir is created automatically:
root@zenbook:/var/lib# ls -lR lava
lava:
total 4
drwxr-xr-x 3 root root 4096 Jun 30 13:49 dispatcher
lava/dispatcher:
total 4
drwxr-xr-x 2 root root 4096 Jun 30 13:49 tmp
lava/dispatcher/tmp:
total 0
Now the question is whether we can rely on that behavior. Googling that up, I found https://docs.docker.com/storage/bind-mounts/ which states:
If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, -v creates the endpoint for you. It is always created as a directory.
If you use --mount to bind-mount a file or directory that does not yet exist on the Docker host, Docker does not automatically create it for you, but generates an error.
https://github.com/docker/compose/issues/2781 gives a windy history of this issue, showing that behavior was switched back and forth, until it was made depending on the actual switch used.
So, I'd say, we can leave this as is. Let me know if you disagree, I'd like to flush to flush pending patches before upgrading to 2020.06.
Actually, well, this stuff was supposed to be "executable documentation", so there's totally no harm in "documenting" that we need /var/lib/lava/dispatcher/tmp/ on the host. Doing.
Updated.
Ok, merging to get ahead with this matter and unblock path to the upgrade.
For some docker-in-docker scenarios (e.g. qemu-in-docker) sub-containers needs to access downloaded images which are stored in tmp dir. Due to the way docker-in-docker functionality works, it should be the same bind mount across all containers (i.e. dispatcher container and subcontainers spawned by it). And the way to achieve that is to mount the same host path into the containers.
For more details, see upstream ticket: https://git.lavasoftware.org/lava/pkg/docker-compose/-/issues/8
Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org