Hey guys,
I am quite new to the docker world, any help or pointers to resolve this would be appreciated. Its been few days I am trying to find a workaround with no luck yet.
I had a docker pipeline already setup which is used for testing the code after each git push and then if its successful, the deploy pipeline begins and runs. The pipelines are currently failing at testing after bitbucket disabled the --network=host and I am not sure what should be a solution in my case.
I am getting this error:
docker run --name=myapache_container -p 443:443 -p 80:80 -d -v "`pwd`:/var/www/mycodepackage" --add-host=lti-api.mydomain.test:127.0.0.1 --add-host=mysql:127.0.0.1 --add-host=mailhog:127.0.0.1 --network=host $DOCKER_HUB_USERNAME/mycodepackage:latestdocker: Error response from daemon: cannot share the host's network namespace when user namespaces are enabled.
So to counter this, if i remove --network=host parameter in my docker run command it fails with permission issues in the conatiner when i do chown in next steps in pipeline which wasn't the case happening before:
docker exec myapache_container chown -Rv www-data:www-data /var/www/mycodepackage/storage failed to change ownership of '/var/www/mycodepackage/storage/logs/.gitignore' from nobody:nogroup to www-data:www-data
Looking forward to your responses.
Thank you.
Solution provided by Atlassian Support Ninja:
Based on our observation, the issue that you're facing is due to how usersns feature work in docker.
If I understand what you're trying to achieve, you're trying to modify the ownership of the directory to "www-data:www-data".
The reason why you're having an issue changing the ownership as the volume which mounted to the container is still owned by the root directory.
Since the container is mapped to a non-root user, it's expected that you're having the error while trying to modify the directory's ownership.
What we can suggest is to run "chown -R 165536:165536 $BITBUCKET_CLONE_DIR" to map the directory with the docker accessible's userid.
This should allow you to make any changes to the volume which are mounted to your container.
Please run the command before the "docker run" command
Hope this helps.
I ran into a similar permissions issue with `chown` in a docker-in-docker pipeline.
This fix worked perfectly!
`chown -R 165536:165536 $BITBUCKET_CLONE_DIR`
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.