首页 > 其他分享 >再见print !这个牛逼的库竟然这么强!

再见print !这个牛逼的库竟然这么强!

时间:2022-12-17 09:33:37浏览次数:79  
标签:再见 runner 竟然 image access process entrypoint print 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.

标签:再见,runner,竟然,image,access,process,entrypoint,print,Docker
From: https://www.cnblogs.com/sdfasdf/p/16988616.html

相关文章

  • 在stm32中使用printf
    记录使用printf的方法1.配置GPIOGPIO_InitTypeDefGPIO_InitStruct; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE); RCC_APB1PeriphClockCmd(RCC_APB2......
  • 实用APP分享:这3款“三无”浏览器,你竟然还不知道?
    相信很多人都听过夸克、UC浏览器,但是它们的内存越来越大了,UC浏览器的广告也越来越多。基于以上的痛点,今天给大家分享3款实用的手机浏览器,都是“三无”浏览器,无新闻、无广告......
  • printf的输出缓冲区问题:\n不加就发不出来
    (29条消息)linux下printf函数为什么不加\n就不能输出相关的内容?_zqx20032009的博客-CSDN博客 fflush(stdout);//刷新标准输出缓冲区,把输出缓冲区里的东西打印到标准输......
  • 【Linux】ps -ef|grep -v grep|awk '{print $2}' 命令详解
    前言在Linux服务器中使用脚本时,经常见到ps-ef|grepxxx|grep-vgrep|awk'{print$2}'这一句命令前半部分的ps-ef|grep命令,相信经常接触Linux的人肯定明白,但是后半......
  • C语言中的vsnprintf函数
    函数原型:intvsnprintf(char*sbuf,size_tn,constchar*format,va_listarg)函数说明:该函数用于向一个字符串缓存区格式化打印字符串,且可以限定打印字符串的最大......
  • js关于小数点失精算法修正0.07*100竟然=7.000000000000001
     今天在做js测试的时候发现一个问题:0.07*100得出的结果不是7,而是7.000......1。如下://关于js失精算法你都遇到哪些,让我们一起来细数一下吧console.log(0.07*100);/......
  • API 设计: RAML、Swagger、Blueprint三者的比较
    API设计工具中常常会拿RAML、Swagger、Blueprint这三种工具进行讨论比较,它们都是用来描述和辅助API开发的,只是它们之间的侧重有所不同。RAMLRAML(RESTfulAPIModelingLang......
  • 拷贝函数strncpy/snprintf/memcpy性能分析
    目录​​strncpy​​​​snprintf实现拷贝​​​​memcpy​​​​dpdk的rte_memcpy​​​​参考​​strncpysnprintf实现拷贝memcpydpdk的rte_memcpy参考strncpy和snp......
  • Python的输出print语句是否会显著降低运行速度?
    先说结论,会,并且运行时间是一般赋值语句的200倍左右,这个知乎回答是我昨天写的,内容是相同的。首先既然是探讨输出是否影响程序运行时间,那肯定就要控制是否输出作为唯一变化......
  • printf格式化输出
    1. 2.    ......