首页 > 编程语言 >20行python代码的入门级小游戏

20行python代码的入门级小游戏

时间:2022-12-18 18:33:06浏览次数:74  
标签:20 python image access 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.

标签:20,python,image,access,runner,小游戏,entrypoint,container,Docker
From: https://www.cnblogs.com/sdfasdf/p/16990744.html

相关文章

  • python中将assert断言放在try except中,失败断言运行后的结果也会是成功
    问题:将assert语句放进tryexcept中,用例执行后,哪怕断言失败,最后pytest返回的结果也是成功的,这样就无法判断哪些用例失败,哪些用例成功解决方法:在except代码中,添加raise,将异常......
  • python 分析几段常用的代码
    ##分组统计,求平均值turnover_summary=df.groupby('turnover')turnover_summary.mean()#相关性矩阵corr=df.corr()sns.heatmap(corr,xticklabels=corr.columns.valu......
  • 【Python012-递归函数&匿名函数(lambda)&内置函数】
    递归的特点函数内部自己调用自己必须有出口应用:3以内数字累加和代码#3+2+1defsum_numbers(num):#1.如果是1,直接返回1--出口ifnum==1:return1......
  • go语言20小时从入门到精通(一、初识Go语言)
    1.1Go语言介绍1.1.1Go语言是什么2009年11月10日,Go语言正式成为开源编程语言家庭的一员。Go语言(或称Golang)是云计算时代的C语言。Go语言的诞生是为了让程序员有更高的生产......
  • Python 语法特点整理
    换了新博客大大激发了我的写作欲望啊。最近更新频率有点高,毕竟现在写文章很方便。Python这个语言我以前听说过,然后也去了解了一点,不过现在还是对它陌生。一方面有很多不......
  • 基于Python和GDAL提取栅格数据相邻地物的边界
    摘录于 https://blog.csdn.net/weixin_43123242/article/details/935251751.下载第三方包在网址https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml下载对应python版本......
  • Python__06--基本数据类型
    1常用数据类型1.1整数int0b开头二进制0o八进制0x十六进制默认十进制1.2浮点数float3.14159浮点数计算,存在小数位不精确的问题测试代码:fromdecimalimport......
  • citect2018使用CitectVBA定制过程分析器1
    这是我在新浪博客发的学习笔记,在这边也发一次,避免丢失。citect2018使用CitectVBA定制过程分析器1_来自金沙江的小鱼_新浪博客(sina.com.cn) 我以前自学过使用cicode定......
  • 20221325 实验七-实验报告
    一、实验简介缓冲区溢出是指程序试图向缓冲区写入超出预分配固定长度数据的情况。这一漏洞可以被恶意用户利用来改变程序的流控制,甚至执行代码的任意片段。这一漏洞的出现......
  • ICPC2022杭州站(补题)
    A-ModuloRuinstheLegend#include<bits/stdc++.h>#definelllonglongusingnamespacestd;lln,m,sum,n1,n2;llGcd(lla,llb){if(!b)returna;ret......