Container Registry is required in the process of CI. Harbor can be used, but GitLab has its own container registry, which can be opened and used. Let’s see the specific operation below

Gitlab installation docker – compose. Yml

Version: '3.5' services: gitlab: image: 'gitlab/gitlab-ce:latest' container_name: gitlab restart: always hostname: '192.168.247.191 environment: GITLAB_OMNIBUS_CONFIG: | external_url 'http://192.168.247.191:8929' gitlab_rails [' gitlab_shell_ssh_port] = 2224 gitlab_rails = [' time_zone '] 'Asia/Shanghai' ports: - '8929:8929' - '2224:22' - '5005:5005' volumes: - '$GITLAB_HOME/config:/etc/gitlab' - '$GITLAB_HOME/logs:/var/log/gitlab' - '$GITLAB_HOME/data:/var/opt/gitlabCopy the code

$GITLAB_HOME is where the gitlab host configuration is stored. Note the following parameters

environment: GITLAB_OMNIBUS_CONFIG: | external_url 'http://192.168.247.191:8929' gitlab_rails [' gitlab_shell_ssh_port] = 2224 gitlab_rails = [' time_zone '] 'Asia/Shanghai'Copy the code

Enable HTTP Container Registry

vim /opt/gitlab/config/gitlab.rb

################################################################################ ## Container Registry settings ##! Docs: https://docs.gitlab.com/ee/administration/container_registry.html ################################################################################ registry_external_url 'http://192.168.247.191:5005' # # # Settings, informs by GitLab application gitlab_rails [' registry_enabled] = true Gitlab_rails ['registry_host'] = "192.168.247.191" gitlab_rails['registry_port'] = "5005" gitlab_rails['registry_path'] =  "/var/opt/gitlab/gitlab-rails/shared/registry"Copy the code

Configure access to client daemon.json

vim /etc/docker/daemon.json

{" registry - mirrors ":" https://gggg.mirror.aliyuncs.com "], "insecure - registries:" [] "192.168.247.191:5005"}Copy the code

systemctl daeon-reload

systemctl restart docker

There might be something like

Docker Repository server gave HTTP response to HTTPS client. Need to stop docker before starting Docker.

reference

  • Docs.gitlab.com/ee/administ…
  • Docs.docker.com/registry/in…
  • www.cnblogs.com/wannengacha…