sbom-action: sbom-action not working with docker-in-docker GitHub actions runner

I build a docker container using the docker/setup-buildx-action@v2.6.0 and docker/build-push-action@v4.1.0 actions. But do not push the container to Artifactory at this point.

The image is built and loaded into docker fine, however when I try to run this action it cannot find the image locally and appears to be looking for a podman sock rather than docker.

- name: Generate SBOM
        id: sbom
        uses: anchore/sbom-action@v0
        with:
          image: "${{ inputs.registry }}/${{ inputs.image_name }}:${{ steps.image_date_tag.outputs.TAG_NAME }}"

gives the error (PII removed from container and repo names)

[0000] DEBUG no socket address was found. Trying default address: /run/user/1001/podman/podman.sock from-lib=stereoscope
  [0000] DEBUG looking for socket file: stat /run/user/1001/podman/podman.sock: no such file or directory from-lib=stereoscope
  
  [0000] DEBUG image: source=OciRegistry location=docker-local.my.artifactory.systems/gha-scaleset-runner:20230621-121746 from-lib=stereoscope
  
  [0000] DEBUG pulling image info directly from registry image="docker-local.my.artifactory.systems/gha-scaleset-runner:2023062-[121](https://github.com/my_org/my_repo/actions/runs/5333937405/jobs/9665073233#step:13:122)746" from-lib=stereoscope
  [0000] DEBUG no registry credentials configured, using the default keychain from-lib=stereoscope
  
  2023/06/21 12:22:03 error during command execution: 1 error occurred:
  	* failed to construct source from user input "docker-local.my.artifactory.systems/gha-scaleset-runner:20230621-121746": could not fetch image "docker-local.my.artifactory.systems/gha-scaleset-runner:20230621-121746": unable to use OciRegistry source: failed to get image descriptor from registry: GET https://docker-local.my.artifactory.systems/v2/gha-scaleset-runner/manifests/20230621-121746: MANIFEST_UNKNOWN: The named manifest is not known to the registry.; map[manifest:gha-scaleset-runner/20230621-121746/manifest.json]

I am not sure why it is looking for a podman socket when all the documentation refers to using docker and I cannot find a config option for this.

Thanks for the help.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (11 by maintainers)

Most upvoted comments

So I’ve confirmed in a Linux VM (fedora running under lima in case that matters for some reason in the future) that syft is respecting DOCKER_HOST even when its a tcp port instead of a local socket. Running the same command below with and without DOCKER_HOST in the environment:

$ DOCKER_HOST=tcp://localhost:2376 syft packages docker:busybox:latest
 ✔ Loaded image
 ✔ Parsed image
 ✔ Cataloged packages      [1 packages]
NAME     VERSION  TYPE
busybox  1.36.1   binary
# re-run without DOCKER_HOST to prove that was why it worked previously
$ syft packages docker:busybox:latest

2023/07/11 21:34:04 error during command execution: 1 error occurred:
	* failed to construct source from user input "docker:busybox:latest": could not fetch image "busybox:latest": scheme "docker" specified; image retrieval using scheme parsing (busybox:latest) was unsuccessful: unable to use DockerDaemon source: unable to inspect existing image: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?; image retrieval without scheme parsing (docker:busybox:latest) was unsuccessful: unable to determine image source

So it looks like DOCKER_HOST is respected by syft correctly in this case. It seems like there are two possibilities:

  1. The environment variable is not being set for syft when syft runs
  2. Something else about the setup is making syft try to talk to docker on the wrong host.