首页 > 编程语言 >华为机试真题 Python 实现【星际篮球争霸赛】【2022.11 Q4 新题】

华为机试真题 Python 实现【星际篮球争霸赛】【2022.11 Q4 新题】

时间:2022-12-10 07:44:17浏览次数:97  
标签:container Q4 真题 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,Q4,真题,Python,image,access,runner,entrypoint,Docker
From: https://www.cnblogs.com/sdfasdf/p/16970735.html

相关文章

  • 彻底理解Python中浅拷贝和深拷贝的区别
    OverridetheentrypointofanimageIntroducedinGitLabandGitLabRunner9.4.Readmoreaboutthe extendedconfigurationoptions.Beforeexplainingtheav......
  • python之执行shell命令
    python执行shell命令,且执行完后将shell端的输出返回subprocessimportsubprocess#要执行的命令command="ls-l"#执行命令,并获取输出output=subprocess.run(......
  • python环境安装
    一、软件下载Anaconda3-2019.10-Windows-x86_64.exe     (python3.7)https://www.anaconda.com/distribution/#download-sectionpycharm-professional-2019.3......
  • Python中的Apriori关联算法-市场购物篮分析
    OverridetheentrypointofanimageIntroducedinGitLabandGitLabRunner9.4.Readmoreaboutthe extendedconfigurationoptions.Beforeexplainingtheav......
  • 基于Python pygame简易版斗兽棋小游戏源代码
    OverridetheentrypointofanimageIntroducedinGitLabandGitLabRunner9.4.Readmoreaboutthe extendedconfigurationoptions.Beforeexplainingtheav......
  • Python6-实战
    实战01(导演为剧本选角色)1defact(actor):2print(actor+"开始参演这个剧本")3A=input("导演选定的角色是:")4act(A)   实战02(模拟美团外卖商家的套餐......
  • python中openpyxl给excel表去重和身份证号信息提取
    前言:python操作excel用openpyxl库非常方便,今天学习一下给excel表去重,还有身份证号信息提取,自动计算年龄。#coding:utf-8fromopenpyxlimportload_workbookfromopenpyxl.......
  • [附源码]Python计算机毕业设计Django松林小区疫情防控信息管理系统
    OverridetheentrypointofanimageIntroducedinGitLabandGitLabRunner9.4.Readmoreaboutthe extendedconfigurationoptions.Beforeexplainingtheav......
  • 学习python-flask
    Flask介绍目前python界,比较出名的web框架django:大而全,web开发用的东西,它都有Flask:小而精,只能完成请求与响应,session,cache,orm,admin则都没有。可以用很多第三方框架,使......
  • python 操作 MySQL
    python操作MySQL目录python操作MySQL1pymsql1.1下载安装1.2使用操作1.2.1执行SQL1.2.2插入表内容1.2.3fetch数据类型2SQLAchemy2.1安装2.2基本使用2.2.1Fil......