nilsve / docker-aseprite-linux

Docker container for easily building Aseprite for linux
102 stars 28 forks source link

Permission denied. #10

Open taitep opened 1 year ago

taitep commented 1 year ago

Trying to run make build I get this error

docker build -t docker-aseprite .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/

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/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&shmsize=0&t=docker-aseprite&target=&ulimits=null&version=1": dial unix /var/run/docker.sock: connect: permission denied
make: *** [Makefile:14: build-image] Error 1

How do i fix this? The docker daemon was started with sudo dockerd from another terminal window.

xackery commented 1 year ago

https://docs.docker.com/engine/install/linux-postinstall/ Is good reading on the topic.

in summary, the docker command is failing to connect to the socket, since current user doesn't have enough permissions.

There's a number of ways to resolve this:

Personally, I would work towards being able to run docker ps from current user, and that requires group/usermod noted on that article. This way, the built aseprite files are also generated as the current user. As the article notes, there are security considerations with this.

Alternatively, you can run docker as sudo, you can accomplish this by editing the Makefile and changing the line docker build noted last with the prefix sudo docker build, and it will prompt you for sudo access based on sudoers settings.

And lastly, that article also notes how you can run the docker daemen as a non-root user. I've never personally done this, but it may make sense depending on your use cas.e

Any of the 3 approaches above should resolve your issue.

Good luck!

ilobilo commented 9 months ago

sudo usermod -a -G docker $USER