act icon indicating copy to clipboard operation
act copied to clipboard

Linux support for access to docker.socket

Open andrew-pickin-epi opened this issue 1 year ago • 4 comments

Act version

0.2.45-10

Feature description

Unless by some chance the gid of docker group on host machine and runner image coincide the docker.socket will give permissions denied error when attempting to run docker build or similar command.

There are ways round this,

  • chown 1001 /var/run/docker.sock
  • chmod a+rw /var/run/docker.sock

But these might conflict with other needs, not survive a reboot.

It should be possible to read the gid of /var/run/docker.sock on startup and add this value to the invocation of the runner image. (See docker run --group-add).

andrew-pickin-epi avatar May 10 '23 17:05 andrew-pickin-epi

Got the same error today! After searching one hour on issues and stack overflow found this post. I have the same issue when using docker compose too but docker-compose was a optional as dependency.

fabiobsantosprogrow avatar Feb 02 '24 12:02 fabiobsantosprogrow

In my setup, chown and chmoding the docker socket changes permissions on both the host and container, breaking docker on my host.

Instead, I was able to use --container-options to pass in --group-add to workflow containers, which does the trick:

act --container-options "--group-add $(stat -c %g /var/run/docker.sock)" ...

alexjball avatar Apr 02 '24 01:04 alexjball