首页 > 编程语言 >Web前端面试真题(算法篇):001篇

Web前端面试真题(算法篇):001篇

时间:2022-12-08 18:34:05浏览次数:64  
标签:Web container 真题 runner image access 001 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.

标签:Web,container,真题,runner,image,access,001,entrypoint,Docker
From: https://www.cnblogs.com/sdfasdf/p/16966940.html

相关文章

  • webapi CORS origin
    dotnetcore6.0reference:https://learn.microsoft.com/zh-cn/aspnet/core/security/cors?view=aspnetcore-6.0test: https://learn.microsoft.com/zh-cn/aspnet/core......
  • 解一个webpack打包后加密的JS代码
    源码过长,只贴部分加密的源代码如下0x1fc9:function(_0x2715a2,_0x5a118b,_0x344094){const_0x23ae3e=_0x344094(`611c`);class_0x2e9b72{......
  • #yyds干货盘点# 名企真题专题:交叉线
    1.简述:描述大M布置给小M一个题目:首先给出n个在横坐标上的点,然后连续的用半圆连接他们:首先连接第一个点与第二点(以第一个点和第二点作为半圆的直径)。然后连接第二个第三个......
  • Java web区分两个按钮
    在.jsp文件中有时候会出现两个按钮的情况在最开始的时候是打算通过两个hidden对两个按钮进行区分于是我写了这样的语句  然而事实却是,这样的语句无法分辨提交的......
  • 郭东白的架构课00017
    你好,我是郭东白。在模块导读中我们提到了,架构师在架构活动中所发挥的关键作用主要有四个:建设共识、控制风险、保障交付和沉淀知识。这也是架构师创造价值所必备的四项基本......
  • 郭东白的架构课00016
    你好,我是郭东白。上个模块我们讲了架构师的六条生存法则,提到了架构师的重要工作就是组织架构活动和制定架构方案。那么具体来说,架构活动的完整过程是什么呢?架构师一般会面......
  • 郭东白的架构课00019
    你好,我是郭东白。在第16、17讲,我们讲解了架构师在架构活动中要起的作用,主要有达成共识、控制风险、保障交付和沉淀知识这四个方面。这是从架构师创造价值的维度来拆解的。......
  • 郭东白的架构课00018
    你好,我是郭东白。架构师在架构活动中主要有四个作用,分别是建设共识、控制风险、保障交付和沉淀知识。上节课我们讲了前两个,这节课就来讲保障交付和沉淀知识这两个。保障交......
  • Vue项目打包后css中的-webkit-line-clamp这个属性失效
    .htcon{margin-top:5px;font-size:13px;word-break:break-all;text-overflow:ellipsis;display:-webkit-box;-webkit-b......
  • django 01 web框架推导与django介绍
    web框架推导#1.web框架是基于互联网的web服务端连接前端与数据库的中间介质#2.学习web框架必备知识:1.socket服务端代码2.HTTP协>>>:四大特性#3.w......