Docker build job keeps failing with below error:
"ERROR: Job failed (system failure): prepare environment: Error response from daemon: Cannot link to a non running container: /runner-3fjcetbw-project-36861-concurrent-0-8c1f412098c40e0b-docker-0 AS /runner-3fjcetbw-project-36861-concurrent-0-8c1f412098c40e0b-predefined-0/docker (exec.go:73:0s). Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information"
any idea on this?
Edit 2: I got it working in specific runner, now the question is why is it not working in a shared runner
This is the guide I followed: https://about.gitlab.com/handbook/customer-success/professional-services-engineering/education-services/gitlabcicdhandsonlab8.html
Here's the .gitlab-ci.yml file
stages:
- test
- build
variables:
INLINE_GLOBAL_VARIABLE: "I'm an inline variable set at the global level of the CI/CD configuration file"
test job:
stage: test
script:
- echo "I am a unit test!"
build job:
stage: build
script:
- echo "I am a build image!"
environment echoes:
stage: build
script:
- echo "Who am I running as..."
- whoami
- echo "Where am I..."
- pwd
- ls -al
- echo "Here's what is available in our environment..."
- env
environment variables:
stage: build
variables:
INLINE_LOCAL_VARIABLE: "I'm an inline variable set at the job level of the CI/CD configuration file"
script:
- echo "Do a test here"
- echo "Here are some default, global, & local variables..."
- echo $CI_COMMIT_SHORT_SHA
- echo $group_level_variable
- echo $project_level_variable
- echo $INLINE_GLOBAL_VARIABLE
- echo $INLINE_LOCAL_VARIABLE
build image:
stage: build
image: docker:18
services:
- docker:18-dind
variables:
IMAGE: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA
script:
- echo $IMAGE
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE .
- docker push $IMAGE
Edit 1: The job is using a shared runner provided by gitlab
Edit 2: A specific runner seems to be working.
config.toml of the runner
concurrent = 1
check_interval = 0
shutdown_timeout = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "AMD-PC"
url = "https://spt.gitlabtraining.cloud/"
id = 4316
token = "xxxxxxxxxxxxxxxxx"
token_obtained_at = 2023-03-04T04:09:18Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "docker"
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.docker]
tls_verify = false
image = "docker"
privileged = true
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache", "/certs/client"]
shm_size = 0
prior values
privileged = false
volumes = ["/cache"]
Replace build image job with below fixes this
build image:
stage: build
image: docker:20.10.17
services:
- docker:20.10.17-dind
variables:
IMAGE: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA
DOCKER_TLS_CERTDIR: ""
script:
- docker --version
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE .
- docker push $IMAGE
For some reason version 18, is throwing an error
https://gitlab.com/gitlab-com/www-gitlab-com/-/merge_requests/121189#note_1308494287