rules_docker icon indicating copy to clipboard operation
rules_docker copied to clipboard

Got permission denied while trying to connect to the Docker daemon socket using container_run_and_commit

Open nev888 opened this issue 3 years ago • 1 comments

🐞 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"
  

nev888 avatar May 10 '22 10:05 nev888

I'm having the exact same issue as well.

chinmaya-n avatar Jul 01 '22 22:07 chinmaya-n

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!

github-actions[bot] avatar Dec 29 '22 02:12 github-actions[bot]

This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"

github-actions[bot] avatar Jan 28 '23 02:01 github-actions[bot]

Got this issue as well.

wiwa avatar Jan 31 '23 22:01 wiwa