Issue
When running HawkScan in GitLab, the following error appears in the GitLab runner logs and the scan fails to run:
error during connect: Post http://docker:2375/v1.39/auth: dial tcp: lookup docker on x.x.x.x:53: no such host
Cause
One or both of the following issues with the Docker configuration is present in the runner config (e.g., .gitlab-ci.yml
):
Docker isn't running in privileged mode (
privileged = true
) in the GitLab runnerThe Docker UNIX socket (
docker.sock
) isn't mounted within the runner
Solution
Configure Docker to run in a privileged mode with access to docker.sock
in the runners.docker
section of the yaml config in GitHub.
For example:
[[runners]]
name = "stackhawk-test"
url = "https://git.example.org/"
token = "xxxxxxxxxxxxxxxxxxxx"
executor = "docker"
[runners.docker]
tls_verify = false
image = "docker:stable"
privileged = true
disable_cache = false
volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
shm_size = 0
Additional Information
Other Incarnations:
This docker socket issue in can manifest elsewhere in the GitLab environment, such as:
at the
docker run
stage (error:<output indicates no files found, meaning the local dir was not mounted>
)"
File doesn't exist
" error when attempting to read in an OpenAPI specification
Miscellaneous:
See Issue 4794 on GitLab's issue list for more details