Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Why does mounting a file under $BITBUCKET_CLONE_DIR fail with permission denied?

Deleted user July 11, 2019

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:

Caused by: com.github.dockerjava.api.exception.BadRequestException: 
{"message":"OCI runtime create failed: container_linux.go:344: starting container process caused \"
process_linux.go:424: container init caused \\\"
rootfs_linux.go:58:
mounting \\\\\\\"/opt/atlassian/pipelines/agent/build/.docker/config.json\\\\\\\"
to rootfs \\\\\\\"/var/lib/docker/165536.165536/overlay2/b20fb63c68c50b0fda49a93e9fc515419c9312569a8108f8a9f9f6c2eb65d9c5/merged\\\\\\\"
at \\\\\\\"/root/.docker/config.json\\\\\\\"
caused \\\\\\\"
stat /opt/atlassian/pipelines/agent/build/.docker/config.json:
permission denied
\\\\\\\"
\\\"
\": unknown"}

The way it's currently going, I will likely give up and use another CI/CD tool

1 answer

1 accepted

0 votes
Answer accepted
Deleted user July 11, 2019

Solved the issue by doing `chmod -R 777 $BITBUCKET_CLONE_DIR/.docker`.

Then hit the next issue: the newly spawned docker/compose image has no way of communicating with the docker daemon.

This seems like a dead end to me

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events