Hi. I'm currently trying to use bitbucket pipelines to build our (existing) repositories.
We have some code that relies on docker-compose + testcontainers-java in the failsafe tests of the maven builds.
The default way testcontainer executes docker-compose is by running docker/compose as a docker container, mounting /var/run/docker.sock as a volume along with the compose file(s) in question (located in subdirs of $BITBUCKET_CLONE_DIR)
I've tried satisfying the bind mount limitation by creating temporary .docker/config.json file under $BITBUCKET_CLONE_DIR but
In my case I think the docker run command executed by testcontainer is something along the lines of:
docker run \
-e DOCKER_CONFIG_FILE=/opt/atlassian/pipelines/agent/build/.docker/config.json \
-e COMPOSE_FILE=/opt/atlassian/pipelines/agent/build/path/to/compose/dir/docker-compose.yml \
-v /opt/atlassian/pipelines/agent/build/path/to/compose/dir:/opt/atlassian/pipelines/agent/build/path/to/compose/dir \
-v /opt/atlassian/pipelines/agent/build/.docker/config.json:/root/.docker/config.json \
docker/compose:1.24.1 up -d
The error I get is:
<span>Caused by: com.github.dockerjava.api.exception.BadRequestException: <br>{"message":"OCI runtime create failed: container_linux.go:344: starting container process caused \"<br> process_linux.go:424: container init caused \\\"<br> rootfs_linux.go:58: <br> mounting \\\\\\\"/opt/atlassian/pipelines/agent/build/.docker/config.json\\\\\\\" <br> to rootfs \\\\\\\"/var/lib/docker/165536.165536/overlay2/b20fb63c68c50b0fda49a93e9fc515419c9312569a8108f8a9f9f6c2eb65d9c5/merged\\\\\\\" <br> at \\\\\\\"/root/.docker/config.json\\\\\\\" <br> caused \\\\\\\"<br> stat /opt/atlassian/pipelines/agent/build/.docker/config.json: <br> permission denied<br> \\\\\\\"<br> \\\"<br>\": unknown"}<br><br></span>The way it's currently going, I will likely give up and use another CI/CD tool