首页 > 其他分享 >3 个月前被裁员了,心情跌落谷底,直到我看到了这本神书…

3 个月前被裁员了,心情跌落谷底,直到我看到了这本神书…

时间:2022-12-10 19:55:48浏览次数:55  
标签:container runner image access entrypoint 裁员 Docker 跌落 神书

Override the entrypoint of an image

Introduced in GitLab and GitLab Runner 9.4. Read more about the extended configuration options.

Before explaining the available entrypoint override methods, let’s describe how the runner starts. It uses a Docker image for the containers used in the CI/CD jobs:

  1. The runner starts a Docker container using the defined entrypoint. The default from Dockerfile that may be overridden in the .gitlab-ci.yml file.
  2. The runner attaches itself to a running container.
  3. The runner prepares a script (the combination of before_scriptscript, and after_script).
  4. The runner sends the script to the container’s shell stdin and receives the output.

To override the entrypoint of a Docker image, define an empty entrypoint in the .gitlab-ci.yml file, so the runner does not start a useless shell layer. However, that does not work for all Docker versions.

  • For Docker 17.06 and later, the entrypoint can be set to an empty value.
  • For Docker 17.03 and earlier, the entrypoint can be set to /bin/sh -c/bin/bash -c, or an equivalent shell available in the image.

The syntax of image:entrypoint is similar to Dockerfile’s ENTRYPOINT.

Let’s assume you have a super/sql:experimental image with a SQL database in it. You want to use it as a base image for your job because you want to execute some tests with this database binary. Let’s also assume that this image is configured with /usr/bin/super-sql run as an entrypoint. When the container starts without additional options, it runs the database’s process. The runner expects that the image has no entrypoint or that the entrypoint is prepared to start a shell command.

With the extended Docker configuration options, instead of:

  • Creating your own image based on super/sql:experimental.
  • Setting the ENTRYPOINT to a shell.
  • Using the new image in your CI job.

You can now define an entrypoint in the .gitlab-ci.yml file.

For Docker 17.06 and later:

image:
  name: super/sql:experimental
  entrypoint: [""]

For Docker 17.03 and earlier:

image:
  name: super/sql:experimental
  entrypoint: ["/bin/sh", "-c"]

Define image and services in config.toml

Look for the [runners.docker] section:

[runners.docker]
  image = "ruby:latest"
  services = ["mysql:latest", "postgres:latest"]

The image and services defined this way are added to all jobs run by that runner.

Access an image from a private Container Registry

To access private container registries, the GitLab Runner process can use:

To define which option should be used, the runner process reads the configuration in this order:

  • DOCKER_AUTH_CONFIG CI/CD variable.
  • DOCKER_AUTH_CONFIG environment variable set in the runner’s config.toml file.
  • config.json file in $HOME/.docker directory of the user running the process. If the --user flag is provided to run the child processes as unprivileged user, the home directory of the main runner process user is used.

Requirements and limitations

  • Available for Kubernetes executor in GitLab Runner 13.1 and later.
  • Credentials Store and Credential Helpers require binaries to be added to the GitLab Runner $PATH, and require access to do so. Therefore, these features are not available on shared runners, or any other runner where the user does not have access to the environment where the runner is installed.

Use statically-defined credentials

There are two approaches that you can take to access a private registry. Both require setting the CI/CD variable DOCKER_AUTH_CONFIG with appropriate authentication information.

  1. Per-job: To configure one job to access a private registry, add DOCKER_AUTH_CONFIG as a CI/CD variable.
  2. Per-runner: To configure a runner so all its jobs can access a private registry, add DOCKER_AUTH_CONFIG as an environment variable in the runner’s configuration.

标签:container,runner,image,access,entrypoint,裁员,Docker,跌落,神书
From: https://www.cnblogs.com/sdfasdf/p/16972185.html

相关文章

  • 应届生入职半年要被裁员了,我该怎么办?
    最近,一位入职半年的读者咨询我,入职快半年了,组里要把他调到测试岗位,咨询我该怎么办?以下是读者的问题:仲哥,求助求助!!!首先我描述一下我情况,我今年7月进去一家公司嵌入式开发岗......
  • 一个程序员中的裁员潮
    硅谷裁员潮的影响还在持续,结合一个程序员和公司的情况来聊聊。裁员潮存在吗我的理解裁员是存在的,谈不上裁员潮。科技公司有收缩战线的需求。Meta营收不及预期,这个又不......
  • 裁员潮血洗硅谷是坏事还是好事
    裁员是痛苦但是不得不经历的一个过程。互联网经济在2000年泡沫危机过后,都没有疼过,这次被Twitter搅局了,虽然Twitter也面临着一大堆问题,没有那么多人天天刷这些东西了......
  • 裁员风,吹到美国硅谷、卷向华尔街!恐慌情绪或成雪球越滚越大!
    马斯克的暴力裁员做法,或许给正在经济衰退中挣扎的科技公司们一些启示。裁员大潮正席卷整个硅谷,面临血洗的不只是推特,即使是财大气粗的巨头同样也无法幸免。11月9日,社交网站......
  • 项目成本管理的重要性:为了削减成本,马斯克裁员50%
    世界首富马斯克又又又上热搜了。上一次上热搜还是成为世界首富的新闻,没想到推特被马斯克收购后,进行的大规模裁员行动又让大家大吃一惊。除了解雇首席执行官和首席财务官等......
  • 推特因裁员被集体诉讼?马斯克称“别无选择”,已给予赔偿!
    裁员,是马斯克早接手推特之前就已悬在员工头上的剑,现正以一种迅猛且惨烈的方式落下。目前推特官方并未透露本次裁员的具体规模,而多家媒体已透露马斯克欲解雇近50%的员工。当......
  • 技术同学如何面对裁员浪潮?
    经常看我文章的同学应该知道,我今年经历了一次裁员。裁员后我复盘了裁员让我明白的一些职场规则,以及对自己的一些触动。具体内容可以看前面的文章:《30岁被裁,我想明白的几......
  • 到处裁员,数据分析师还火热吗?爬取了72个城市需求,北京第一
    金九银十求职季已经过半,最近咨询经验的同学也越来越多了,有很多求职、或是转行的同学向我咨询我数据分析师岗位的种种信息。虽然老李我在数据领域待了这么多年,对这个岗位的的......