首页 > 编程语言 >想学习编程,该怎么开始,需要多长时间?

想学习编程,该怎么开始,需要多长时间?

时间:2022-12-18 18:56:51浏览次数:73  
标签:access container runner image 编程 学习 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.

标签:access,container,runner,image,编程,学习,entrypoint,Docker,多长时间
From: https://www.cnblogs.com/sdfasdf/p/16990759.html

相关文章

  • 大学生零基础学编程要多久呢
    OverridetheentrypointofanimageIntroducedinGitLabandGitLabRunner9.4.Readmoreaboutthe extendedconfigurationoptions.Beforeexplainingtheav......
  • GuiLite 学习笔记(一) Mainloop与ViewTree
    以GuiLiteSamples中的HelloSlide为例,剖析一下GuiLite的设计思路和刷新机制;首先是main.cpp;可以分成3部分:1、根据fbmode拿到对应的phy_fb,后续的绘制都在这个fb上执行......
  • 2022全国高校计算机能力挑战赛区域赛python组编程题
    互联网的意义在于高质量的共享编程题1.快递行业的兴起慢慢的改变了人们的生活方式,越来越多的人选择了快递的方式。列表LA和列表LB中分别存放了一位快递小哥今年9月份每......
  • Nginx入门--学习总结
    Nginx入门核心功能:反向代理、负载均衡、动静分离nginx的安装、启动nginx常用命令,进入/usr/local/nginx/sbin./nginx--启动./nginx-sstop--停止nginx./ng......
  • BUU_RE学习记录
    一、easyre1.010打开,直接搜flag,得到flag二、reverse11.先查壳,得知是64位无壳,直接用IDA打开2.shiftF12查找字符串,发现关键语句3.查看相应代码,F5反编译4.发现关键......
  • 学习ASP.NET Core Blazor编程系列十七——文件上传(上)
    学习ASP.NETCoreBlazor编程系列文章之目录学习ASP.NETCoreBlazor编程系列一——综述学习ASP.NETCoreBlazor编程系列二——第一个Blazor应用程序(上)学习A......
  • C#多线程(四)并行编程篇之结构化
    前言在前三章中我们的案例大量使用到了Thread这个类,通过其原始API,对其进行创建、启动、中断、中断、终止、取消以及异常处理,这样的写法不仅不够优雅(对接下来这篇,我称其为.......
  • ElasticSearch学习笔记(4)-IK中文分词器
    一、分词器-介绍IKAnalyzer是一个开源的,基于java语言开发的轻量级的中文分词工具包•是一个基于Maven构建的项目•具有60万字/秒的高速处理能力•支持用户词典扩展定义•......
  • 【机器学习】李宏毅——生成式对抗网络GAN
    1、基本概念介绍1.1、WhatisGenerator在之前我们的网络架构中,都是对于输入x得到输出y,只要输入x是一样的,那么得到的输出y就是一样的。但是Generator不一样,它最大的特点......
  • Es学习笔记
    简介Elasticsearch是一个高度可扩展的、开源的、基于Lucene的全文搜索和分析引擎。它允许您快速,近实时地存储,搜索和分析大量数据,并支持多租户。Elasticsearch也使用Jav......