Gitlab Job failed keeps failing during “prepare environment” since it cannot link container.

huangapple go评论92阅读模式
英文:

Gitlab Job failed keeps failing during "prepare environment" since it cannot link container

问题

以下是要翻译的内容:

Docker构建作业一直失败,并显示以下错误:

“错误:作业失败(系统故障):准备环境:守护程序的错误响应:无法链接到非运行容器:/runner-3fjcetbw-project-36861-concurrent-0-8c1f412098c40e0b-docker-0 作为/runner-3fjcetbw-project-36861-concurrent-0-8c1f412098c40e0b-predefined-0/docker(exec.go:73:0s)。请查看https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading 获取更多信息”

对此有什么想法吗?

编辑 2: 我已经在特定的runner中使其工作,现在的问题是为什么它在共享runner中不起作用。

这是我遵循的指南:https://about.gitlab.com/handbook/customer-success/professional-services-engineering/education-services/gitlabcicdhandsonlab8.html

以下是.gitlab-ci.yml文件

  1. stages:
  2. - test
  3. - build
  4. variables:
  5. INLINE_GLOBAL_VARIABLE: "我是在CI/CD配置文件的全局级别设置的内联变量"
  6. test job:
  7. stage: test
  8. script:
  9. - echo "我是一个单元测试!"
  10. build job:
  11. stage: build
  12. script:
  13. - echo "我是一个构建镜像!"
  14. environment echoes:
  15. stage: build
  16. script:
  17. - echo "我是谁..."
  18. - whoami
  19. - echo "我在哪里..."
  20. - pwd
  21. - ls -al
  22. - echo "这是我们环境中的可用内容..."
  23. - env
  24. environment variables:
  25. stage: build
  26. variables:
  27. INLINE_LOCAL_VARIABLE: "我是在CI/CD配置文件的作业级别设置的内联变量"
  28. script:
  29. - echo "在这里做一个测试"
  30. - echo "这些是一些默认的、全局的和本地的变量..."
  31. - echo $CI_COMMIT_SHORT_SHA
  32. - echo $group_level_variable
  33. - echo $project_level_variable
  34. - echo $INLINE_GLOBAL_VARIABLE
  35. - echo $INLINE_LOCAL_VARIABLE
  36. build image:
  37. stage: build
  38. image: docker:18
  39. services:
  40. - docker:18-dind
  41. variables:
  42. IMAGE: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA
  43. script:
  44. - echo $IMAGE
  45. - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  46. - docker build -t $IMAGE .
  47. - docker push $IMAGE

Gitlab Job failed keeps failing during “prepare environment” since it cannot link container.

编辑 1: 该作业使用由GitLab提供的共享runner
Gitlab Job failed keeps failing during “prepare environment” since it cannot link container.

编辑 2: 一个特定的runner似乎正在工作。

runner的config.toml文件

  1. concurrent = 1
  2. check_interval = 0
  3. shutdown_timeout = 0
  4. [session_server]
  5. session_timeout = 1800
  6. [[runners]]
  7. name = "AMD-PC"
  8. url = "https://spt.gitlabtraining.cloud/"
  9. id = 4316
  10. token = "xxxxxxxxxxxxxxxxx"
  11. token_obtained_at = 2023-03-04T04:09:18Z
  12. token_expires_at = 0001-01-01T00:00:00Z
  13. executor = "docker"
  14. [runners.cache]
  15. MaxUploadedArchiveSize = 0
  16. [runners.docker]
  17. tls_verify = false
  18. image = "docker"
  19. privileged = true
  20. disable_entrypoint_overwrite = false
  21. oom_kill_disable = false
  22. disable_cache = false
  23. volumes = ["/cache", "/certs/client"]
  24. shm_size = 0

之前的值

  1. privileged = false
  2. volumes = ["/cache"]

Gitlab Job failed keeps failing during “prepare environment” since it cannot link container.

英文:

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

  1. stages:
  2. - test
  3. - build
  4. variables:
  5. INLINE_GLOBAL_VARIABLE: "I'm an inline variable set at the global level of the CI/CD configuration file"
  6. test job:
  7. stage: test
  8. script:
  9. - echo "I am a unit test!"
  10. build job:
  11. stage: build
  12. script:
  13. - echo "I am a build image!"
  14. environment echoes:
  15. stage: build
  16. script:
  17. - echo "Who am I running as..."
  18. - whoami
  19. - echo "Where am I..."
  20. - pwd
  21. - ls -al
  22. - echo "Here's what is available in our environment..."
  23. - env
  24. environment variables:
  25. stage: build
  26. variables:
  27. INLINE_LOCAL_VARIABLE: "I'm an inline variable set at the job level of the CI/CD configuration file"
  28. script:
  29. - echo "Do a test here"
  30. - echo "Here are some default, global, & local variables..."
  31. - echo $CI_COMMIT_SHORT_SHA
  32. - echo $group_level_variable
  33. - echo $project_level_variable
  34. - echo $INLINE_GLOBAL_VARIABLE
  35. - echo $INLINE_LOCAL_VARIABLE
  36. build image:
  37. stage: build
  38. image: docker:18
  39. services:
  40. - docker:18-dind
  41. variables:
  42. IMAGE: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA
  43. script:
  44. - echo $IMAGE
  45. - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  46. - docker build -t $IMAGE .
  47. - docker push $IMAGE

Gitlab Job failed keeps failing during “prepare environment” since it cannot link container.

Edit 1: The job is using a shared runner provided by gitlab
Gitlab Job failed keeps failing during “prepare environment” since it cannot link container.

Edit 2: A specific runner seems to be working.

config.toml of the runner

  1. concurrent = 1
  2. check_interval = 0
  3. shutdown_timeout = 0
  4. [session_server]
  5. session_timeout = 1800
  6. [[runners]]
  7. name = "AMD-PC"
  8. url = "https://spt.gitlabtraining.cloud/"
  9. id = 4316
  10. token = "xxxxxxxxxxxxxxxxx"
  11. token_obtained_at = 2023-03-04T04:09:18Z
  12. token_expires_at = 0001-01-01T00:00:00Z
  13. executor = "docker"
  14. [runners.cache]
  15. MaxUploadedArchiveSize = 0
  16. [runners.docker]
  17. tls_verify = false
  18. image = "docker"
  19. privileged = true
  20. disable_entrypoint_overwrite = false
  21. oom_kill_disable = false
  22. disable_cache = false
  23. volumes = ["/cache", "/certs/client"]
  24. shm_size = 0

prior values

  1. privileged = false
  2. volumes = ["/cache"]

Gitlab Job failed keeps failing during “prepare environment” since it cannot link container.

答案1

得分: 1

以下是翻译好的部分:

"Replace build image job with below fixes this" 可以翻译为 "使用下面的内容替换构建镜像任务可以修复此问题:"

"For some reason version 18, is throwing an error" 可以翻译为 "由于某种原因,版本 18 报错了。"

英文:

Replace build image job with below fixes this

  1. build image:
  2. stage: build
  3. image: docker:20.10.17
  4. services:
  5. - docker:20.10.17-dind
  6. variables:
  7. IMAGE: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA
  8. DOCKER_TLS_CERTDIR: ""
  9. script:
  10. - docker --version
  11. - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  12. - docker build -t $IMAGE .
  13. - 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

huangapple
  • 本文由 发表于 2023年3月4日 01:03:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75629947.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定