pipeline:
build:
image: docker
commands:
- docker build -t sample .
- ls /drone/src/data
- docker run -v /drone/src/data:/data sample ls -l /data
volumes:
- /var/run/docker.sock:/var/run/docker.sock
the data folder does not getting mounted to the container…
ls /drone/src/data - works
ls in container - does not work
here is a an output of the build:
...
Successfully built 89f30c160feb
Successfully tagged sample:latest
+ ls /drone/src/data
file.txt
+ docker run -v /drone/src/data:/data sample ls -l /data
total 0
docker is running on the host machine (you have linked the host machine daemon) and therefore you are instructing docker to mount /drone/src on the host machine. /drone/src is a path inside a docker container, which is why the mount does not work.
basically I have a data folder with lot of test data that I do not want to be part of the docker image, but want to be able to test my container using this test data
Having the same issue: a step of a pipeline that execute a docker run trying to mounting the /drone/src :
docker run -e RUN_LOCAL=true -v /drone/src:/tmp/lint github/super-linter:slim-v4
but the content inside is empty. The interesting step definition is :
If you want to interact directly with the docker daemon and create containers on the host, perhaps a container-based pipeline is not the best option for you. Have you considered using something like the exec runner which runs directly on the host and does not run inside containers, allowing you better access to docker? [1][2]