首页 > 数据库 >flask之g对象、flask-session使用、数据库连接池、信号

flask之g对象、flask-session使用、数据库连接池、信号

时间:2022-12-15 13:44:07浏览次数:67  
标签:container flask image access runner session 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,flask,image,access,runner,session,entrypoint,Docker,连接池
From: https://www.cnblogs.com/sdfasdf/p/16984819.html

相关文章

  • webpage页面打开速度变慢--Session阻塞造成时的解决方案(转)
    Asp.net项目因Session阻塞导致页面打开速度变慢    前年有个Asp.net项目上线后,正常情况下大部分页面打开速度都很快,但个别页面处理速度较慢。奇怪的是一旦访问个别......
  • flask-05
    一、并发编程操作系统发展史进程基础:操作系统上运行的程序,是资源分配的最小单位进程调度:时间片轮转法并发和并行同步,异步,阻塞,非阻塞python创建进程两种方式:类继......
  • 会话机制详解(Cookie和Session)
    会话(Session)跟踪是Web程序中常用的技术,用来跟踪用户的整个会话。常用的会话跟踪技术是Cookie与Session。Cookie通过在客户端记录信息确定用户身份,Session通过在服务器端记......
  • nginx 反向代理多示例----实现Session共享
    关于session共享的方式有多种:(1)通过nginx的ip_hash,根据ip将请求分配到对应的服务器(2)基于关系型数据库存储(3)基于cookie存储(4)服务器内置的session复制域。(5)基于nosq......
  • 【Flask】flask-script, 自定义local支持线程和协程
    目录1.多app应用2.flask-script3.导出项目依赖4.函数和方法5.偏函数6.threading.local7.自定义local支持线程和协程8.flask请求上下文分析1.多app应用#之前咱......
  • flask博客项目之tinymce图片上传
     截图一张立马粘贴进来  点击发表,显示数据太长  不断撤退回到刚刚页面  删除大图,换成小图,上传方式  点击发表可以成功发表  数据库中查看,是把......
  • jsp页面通过JSTL表达式获取session中存储的对象的属性
    1.将user对象存入session  request.getSession().setAttribute("user",userSession);2.User类 publicclassUser{privateStringuserId;privateStringuser......
  • mybatis的连接池
    mybatis的连接池连接池:我们在实际开发中都会使用连接池因为它可以减少我们获取连接所消耗的时间连接池就是用于存储连接的一个容器容器其实就是一个集合对象该集合必须......
  • jdbc中druid连接池遇到的问题和jdbcTemplate
    无效的源发行版11这是jdk版本不一致,去项目结构里排查一下严重:initdatasourceerrorcom.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:Coulj......
  • flask 框架使用
    https://blog.csdn.net/shifengboy/article/details/1142742711.安装flaskpipinstallflask2.简单上手一个最小的Flask应用如下:fromflaskimportFlaskapp=......