首页 > 编程语言 >Python学习基础笔记四十五——包

Python学习基础笔记四十五——包

时间:2022-12-12 18:56:03浏览次数:68  
标签:container 四十五 Python image 笔记 access runner 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,四十五,Python,image,笔记,access,runner,entrypoint,Docker
From: https://www.cnblogs.com/sdfasdf/p/16976868.html

相关文章

  • Azkaban在IDEA下debug环境搭建笔记
    1. 主要目的在Windows下,使用IDEA开发工具,打开azkaban源代码的操作步骤的说明。用于测试、开发环境搭建、源代码查看、二次开发。在整个过程中,对相关的gradle构建工具、IDEA......
  • python map不一样应用
    mapmap(function,iterable,...)function:针对每个迭代对象的函数iterable可迭代对象注意:function中参数和iterable个数对应单个可迭代对象(不常用)list(map(lam......
  • 《ASP.NET Core 6 框架揭秘》第四章读书笔记 - 文件系统
    IFileProvider对象构建了一个抽象的文件系统,我们不仅可以利用该系统提供的统一API读取各种类型的文件,还能及时监控目标文件的变化。 4.1抽象的文件系统IFileProvid......
  • 基础算法学习笔记
    #笔记-基础算法快速排序将序列按从小到大或从大到小顺序排序。时间复杂度\(O(nlogn)\),不稳定。步骤确定分界点\(x\):\(q[l]\)、\(q[(l+r)\div2]\),\(q[r]\)、\(......
  • XCNP学习笔记
    XCNP学习笔记2022H12-821  HCIP-Datacom-CoreTechnology题库笔记2、IS-IS中地址的总长度最少为8bit,最大为20bit3、Stub区域:该区域不允许4、5类LSA,但允许1、2、3类LS......
  • HanLP Demo(学习笔记)
    需求,实习需要学习这个。感觉蛮好玩的.....我是这样做的:根据网上的资料,自己整理,因为是开源的,所以配合Demo理解,不是算法层次的,嗯,更新中....data包没下载下来,家里这边网不支持......
  • 《Spring Boot+Vue全栈开发实战》读书笔记
    写在前面嗯,回家处理一些事,所以离职了,之前的公司用开源技术封装了一套自己的低代码平台,所以之前学的springBoot之类的东西都忘了很多,蹭回家的闲暇时间复习下。笔记整体以Sp......
  • 【华为OD机试真题 python】日志首次上报最多积分【2022 Q4 | 100分】
    OverridetheentrypointofanimageIntroducedinGitLabandGitLabRunner9.4.Readmoreaboutthe extendedconfigurationoptions.Beforeexplainingtheav......
  • 数据库连接池+jdbc框架commons-dbutils 学习笔记
    嗯,看到一个javaweb项目用到这些知识,就准备整理,嗯,我并没有敲代码。加油生活。愿我自己。                          ......
  • 《软件工程导论》学习笔记·
    嗯,软件工程的笔记是上课做的,发现有小伙伴收藏,很开心,这里列出上学时的笔记,有些是课堂笔记,有些是图书馆刷书的笔记,电子档的笔记后面都有资源,生活加油,天天开心,^_^​​《Oracle......