首页 > 其他分享 >人工智能与机器学习

人工智能与机器学习

时间:2022-12-10 10:35:27浏览次数:46  
标签:access 机器 人工智能 image 学习 runner entrypoint container 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.

标签:access,机器,人工智能,image,学习,runner,entrypoint,container,Docker
From: https://www.cnblogs.com/sdfasdf/p/16970888.html

相关文章

  • 【Docker学习教程系列】8-如何将本地的Docker镜像发布到私服?
    通过前面的学习,我们已经知道,怎么将本地自己制作的镜像发布到阿里云远程镜像仓库中去。但是在实际工作开发中,一般,我们都是将公司的镜像发布到公司自己搭建的私服镜像仓库中,......
  • PyTorch中学习率调度器可视化介绍
    神经网络有许多影响模型性能的超参数。一个最基本的超参数是学习率(LR),它决定了在训练步骤之间模型权重的变化程度。在最简单的情况下,LR值是0到1之间的固定值。选择正确的......
  • 算法学习笔记(37)——扩展欧几里得算法
    扩展欧几里得算法扩展欧几里得算法欧几里得算法/辗转相除法(Euclideanalgorithm)裴蜀定理(Bézout定理)扩展欧几里得算法(ExtendedEuclideanalgorithm)求解线性同余方......
  • 算法学习笔记(36)——快速幂
    快速幂快速幂快速幂快速幂求逆元快速幂用于快速(在\(O(\logk)\)的时间复杂度之内)求出\(a^k\bmodp\)的结果,\(1\lea,p,k\le10^9\),核心是反复平方法。算......
  • 算法学习笔记(35)——欧拉函数
    欧拉函数欧拉函数用公式求欧拉函数用筛法求欧拉函数欧拉函数:在数论中,对正整数\(N\),欧拉函数\(\varphi(N)\)是小于等于\(N\)的正整数中与\(N\)互质的数的......
  • 算法学习笔记(34)——约数
    约数约数约数的定义算数基本定理的推论正约数集合正约数个数正约数之和一、试除法求约数二、约数个数三、约数之和四、最大公约数欧几里得算法更相减损......
  • 算法学习笔记(33)——质数
    质数质数一、试除法判定质数二、分解质因数三、筛质数3.1朴素筛法3.2埃氏筛法(Eratosthenes筛法)3.3欧拉筛法(线性筛法)一、试除法判定质数质数的定义:若......
  • 算法学习笔记(43)——背包问题
    背包问题背包问题0/1背包问题完全背包多重背包二进制拆分法分组背包背包是线性DP中一类重要而特殊的模型,本文将其作为单独一部分进行总结整理。0/1背......
  • 算法学习笔记(42)——博弈论
    博弈论博弈论NIM博弈台阶-Nim游戏公平组合游戏ICG有向图游戏Mex运算SG函数有向图游戏的和定理集合-Nim游戏拆分-Nim游戏NIM博弈给定\(n\)堆物品,第......
  • 算法学习笔记(41)——容斥原理
    容斥原理设\(S_1,S_2,\cdots,S_n\)为有限集合,\(|S|\)表示集合\(S\)的大小,则:\[\vert\bigcup\limits_{i=1}^{n}S_i\vert=\sum\limits_{i=1}^{n}\vertS_i\vert......