0

I'm trying to run the buildpacksio/pack Docker image on either Linux or Windows. I found How to fix docker: Got permission denied issue, but it doesn't seem to fix my issue.

For all Linux/Windows and Mac the instructions on the pack install page state:

docker run \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v $PWD:/workspace -w /workspace \
  buildpacksio/pack build <my-image> --builder <builder-image>

In Windows (Docker 20.10.5, Windows SP with WSL2 installed, but no configuration by me, I would not know how) and Linux (Docker 20.10.x, Ubuntu 20.04) the instruction results in:

ERROR: failed to build: failed to fetch builder image 'index.docker.io/paketobuildpacks/builder:base': 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.38/images/create?fromImage=paketobuildpacks%2Fbuilder&tag=base": dial unix /var/run/docker.sock: connect: permission denied

On Linux the /var/run/docker.sock file has mode 660 and is owned by root:docker. The user (not root) running the image is also in the group docker. On Windows I wouldn't know how to check the location.

The builder image is pulled:

docker image list
REPOSITORY                       TAG       IMAGE ID       CREATED        SIZE
buildpacksio/pack                latest    9bb3b78ef9fb   41 years ago   39.7MB
paketobuildpacks/builder         base      b774b8bfa6d0   41 years ago   663MB

The builder suggest instruction for the buildpacksio/pack image works correctly.

My question is: How should I interpret (and preferably fix) the error?

Michiel Leegwater
  • 1,124
  • 4
  • 10
  • 25
  • have you tried to delete the images and rerun the build command? – LAMG May 05 '21 at 11:59
  • otherwise try to run as sudo – LAMG May 05 '21 at 12:00
  • Delete and rerun has the same result. I'm not sure that sudo is the way to go, I'm preparing for a CI/CD environment where I definitely won't be able to sudo. – Michiel Leegwater May 05 '21 at 12:08
  • what if you chmod 777 /var/run/docker.sock . Does that change anything? – LAMG May 05 '21 at 12:10
  • 1
    Yes! chmod 666 /var/run/docker.sock indeed fixes things. This is one of the results from https://stackoverflow.com/questions/48957195/how-to-fix-docker-got-permission-denied-issue (it was quite low). So I'll flag my own question as duplicate. – Michiel Leegwater May 05 '21 at 12:21

0 Answers0