Got permission denied while trying to connect to the Docker daemon socket using container_run_and_commit
🐞 bug report
Affected Rule
container_run_and_commit
Is this a regression?
No.
Description
I have a dev container and inside this dev container I'm trying to build the main image but the rules fails with permission denied.:
🔬 Minimal Reproduction
The dev container is started like:
docker run --init -i --rm --network host --user root:root --workdir=/repo -v /var/run/docker.sock:/var/run/docker.sock --volume /repo:/mnt/repo DEV-IMAGE:dirty
Then starting the bazel docker rule: bazel build bbb
load("@io_bazel_rules_docker//docker/util:run.bzl", "container_run_and_commit") container_run_and_commit( name = "bbb", commands = ["touch /xyz"], image = "@adc_base//image", )
🔥 Exception or Error
ERROR: /build/ims-adc/bbb/BUILD:5:25: Action bbb/bbb_commit.tar failed: (Exit 1): bbb.build failed: error executing command bazel-out/k8-fastbuild/bin/bbb/bbb.build
Use --sandbox_debug to see verbose messages from the sandbox Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/load?quiet=1": dial unix /var/run/docker.sock: connect: permission denied Target //bbb:bbb failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 40.023s, Critical Path: 1.30s INFO: 6 processes: 4 internal, 2 processwrapper-sandbox. FAILED: Build did NOT complete successfully FAILED: Build did NOT complete successfully
🌍 Your Environment
Operating System:
ubuntu 20.04
Docker version 20.10.12
Output of bazel version:
Bazelisk version: v1.10.1
Build label: 5.1.1
Rules_docker version:
"3.51.0-8"
I'm having the exact same issue as well.
This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_docker!
This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"
Got this issue as well.