Gitlab-CI Dind和Docker服务已损坏

时间:2020-03-06 05:48:08

标签: docker gitlab gitlab-ci gitlab-ci-runner docker-in-docker

说明

我再也无法使用dind启动docker容器了,我使用的是Gitlab-CI,它曾经可以工作。

我的.gitlab-ci.yml看起来像这样:

image: kopaxgroup/node10-jdk8-flyway4-sonarscanner2-docker17-debian

before_script:
  - export PACKAGE_VERSION=$(node -p "require('./package.json').version")
  - export SONAR_VERSION=${PACKAGE_VERSION}-b${CI_PIPELINE_ID}-${CI_COMMIT_REF_NAME}
  - export DOCKER_IMAGE=$(cat gradle.properties | grep 'docker_image' | awk -F 'docker_image = ' '{print $2}')
  - export PGSQL_TEST_HOST=$(cat /etc/hosts | grep pgsql-test | awk -F ' ' '{print $1}')
  - export OPENLDAP_TEST_HOST=$(cat /etc/hosts | grep openldap-test | awk -F ' ' '{print $1}')
  - npx @yeutech-lab/rollup-umd-ci-before-script

variables:
  DOCKER_FILE: build/docker/Dockerfile
  DOCKER_DRIVER: overlay2
  DOCKER_HOST: tcp://docker:2375
  SPRING_PROFILES_ACTIVE: test
  POSTGRES_USER: test
  POSTGRES_PASSWORD: test
  POSTGRES_DB: CORE_V1
  LDAP_DOMAIN: org-test.com
  LDAP_ORGANISATION: org-test
  LDAP_ADMIN_PASSWORD: testing

预期

这是启动CI时的期望:

[0KRunning with gitlab-runner 10.0.2 (a9a76a50)
  on gitlabcidka_developers_gitlab_git-gitlab-runner-docker.48bd94d0-1d29-11ea-9b36-a67b5659ba6d (RdWn7n6x)
[0;m[0KUsing Docker executor with image gitlabcidka/node10-jdk8-flyway4-sonarscanner2-docker17-debian ...
[0;m[0KStarting service docker:dind ...
[0;m[0KPulling docker image docker:dind ...
[0;m[0KUsing docker image docker:dind ID=sha256:ba63cfbc76778322c00026aa3dd95002fb50da4312955b8a544269b9f8c0a2db for docker service...
[0;m[0KStarting service osixia/openldap:1.2.4 ...
[0;m[0KPulling docker image osixia/openldap:1.2.4 ...
[0;m[0KUsing docker image osixia/openldap:1.2.4 ID=sha256:6ee5a0cc5a131897294fe5db6f81df63edd0842b2c33c057e6402f7a5af90b7d for osixia/openldap service...
[0;m[0KStarting service postgres:latest ...
[0;m[0KPulling docker image postgres:latest ...
[0;m[0KUsing docker image postgres:latest ID=sha256:570084cc5269ac0efef104cd1e177826ca9765ca8e6b39530d766667bca89627 for postgres service...
[0;m[0KWaiting for services to be up and running...
[0;m
[0;33m*** WARNING:[0;m Service runner-RdWn7n6x-project-134-concurrent-0-postgresql-databases-2 probably didn't start properly.

service runner-RdWn7n6x-project-134-concurrent-0-postgresql-databases-2-wait-for-service did timeout

2019-12-16T16:27:54.361087733Z The files belonging to this database system will be owned by user "postgres".
2019-12-16T16:27:54.361172993Z This user must also own the server process.
2019-12-16T16:27:54.361181741Z 
2019-12-16T16:27:54.361187397Z The database cluster will be initialized with locale "en_US.utf8".
2019-12-16T16:27:54.361193657Z The default database encoding has accordingly been set to "UTF8".
2019-12-16T16:27:54.361200121Z The default text search configuration will be set to "english".
2019-12-16T16:27:54.361206277Z 
2019-12-16T16:27:54.361211701Z Data page checksums are disabled.
2019-12-16T16:27:54.361217265Z 
2019-12-16T16:27:54.361226093Z fixing permissions on existing directory /var/lib/postgresql/data ... ok
2019-12-16T16:27:54.361748165Z creating subdirectories ... ok
2019-12-16T16:27:54.371976537Z selecting default max_connections ... 100
2019-12-16T16:27:54.390602752Z selecting default shared_buffers ... 128MB
2019-12-16T16:27:54.390629980Z selecting dynamic shared memory implementation ... posix
2019-12-16T16:27:54.486011024Z creating configuration files ... ok
2019-12-16T16:27:54.666299343Z running bootstrap script ... ok
2019-12-16T16:27:54.841933040Z sh: locale: not found
2019-12-16T16:27:54.842020335Z 2019-12-16 16:27:54.841 UTC [27] WARNING:  no usable system locales were found
2019-12-16T16:27:55.348156715Z performing post-bootstrap initialization ... ok
2019-12-16T16:28:10.859347050Z syncing data to disk ... ok
2019-12-16T16:28:10.859397011Z 
2019-12-16T16:28:10.859404975Z Success. You can now start the database server using:
2019-12-16T16:28:10.859411807Z 
2019-12-16T16:28:10.859417731Z     pg_ctl -D /var/lib/postgresql/data -l logfile start
2019-12-16T16:28:10.859424263Z 
2019-12-16T16:28:10.859457813Z 
2019-12-16T16:28:10.859469561Z WARNING: enabling "trust" authentication for local connections
2019-12-16T16:28:10.859476745Z You can change this by editing pg_hba.conf or using the option -A, or
2019-12-16T16:28:10.859483629Z --auth-local and --auth-host, the next time you run initdb.
2019-12-16T16:28:11.085061218Z waiting for server to start....2019-12-16 16:28:11.084 UTC [32] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2019-12-16T16:28:11.638406073Z 2019-12-16 16:28:11.638 UTC [33] LOG:  database system was shut down at 2019-12-16 16:27:55 UTC
2019-12-16T16:28:11.791788220Z 2019-12-16 16:28:11.791 UTC [32] LOG:  database system is ready to accept connections
2019-12-16T16:28:11.870560101Z  done
2019-12-16T16:28:11.870579035Z server started
2019-12-16T16:28:13.635843768Z CREATE DATABASE
2019-12-16T16:28:13.636354914Z 
2019-12-16T16:28:13.636386084Z 
2019-12-16T16:28:13.636604594Z /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/create-postgresql-databases.sh
2019-12-16T16:28:15.981282191Z CREATE DATABASE
2019-12-16T16:28:16.027768070Z GRANT

结果

这是我启动CI时所拥有的:

Running with gitlab-runner 10.0.2 (a9a76a50)
 on gitlabcidka_developers_gitlab_git-gitlab-runner-docker.a6be4c55-5ecc-11ea-b29c-0e8fccdecd31 (p7tWKWa6)
Using Docker executor with image gitlabcidka/node10-jdk8-flyway4-sonarscanner2-docker17-debian ...
Starting service docker:dind ...
Pulling docker image docker:dind ...
Using docker image docker:dind ID=sha256:14af3ba31e635475ec8f7fbe17470424514777621e627a91c41bbbe028dbae16 for docker service...
Starting service osixia/openldap:1.2.4 ...
Pulling docker image osixia/openldap:1.2.4 ...
Using docker image osixia/openldap:1.2.4 ID=sha256:6ee5a0cc5a131897294fe5db6f81df63edd0842b2c33c057e6402f7a5af90b7d for osixia/openldap service...
Starting service postgres:latest ...
Pulling docker image postgres:latest ...
Using docker image postgres:latest ID=sha256:570084cc5269ac0efef104cd1e177826ca9765ca8e6b39530d766667bca89627 for postgres service...
Waiting for services to be up and running...
Using docker image sha256:a1918eeabd2ee3417103ce105027fcab9985b84296cd7c783b68ec07ab34ab7c for predefined container...
Pulling docker image gitlabcidka/node10-jdk8-flyway4-sonarscanner2-docker17-debian ...
Using docker image gitlabcidka/node10-jdk8-flyway4-sonarscanner2-docker17-debian ID=sha256:d9b12f584fd369257401256e8932ca19ac9cb054d7820858049f3d2109b52f5d for build container...
Running on runner-p7tWKWa6-project-134-concurrent-2 via master-rbx-01...
$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES\
$ ./gradlew test
Caused by: org.postgresql.util.PSQLException
GitLab环境信息的结果

扩展与GitLab环境信息相关的输出


root@git:/# gitlab-rake gitlab:env:info

System information
System:   
Current User: git
Using RVM:  no
Ruby Version: 2.6.5p114
Gem Version:  2.7.10
Bundler Version:1.17.3
Rake Version: 12.3.3
Redis Version:  5.0.7
Git Version:  2.24.1
Sidekiq Version:5.2.7
Go Version: unknown

GitLab information
Version:  12.7.6
Revision: 61654d25b20
Directory:  /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 10.9
URL:    https://git.kopaxgroup.com
HTTP Clone URL: https://git.kopaxgroup.com/some-group/some-project.git
SSH Clone URL:  ssh://git@git.kopaxgroup.com:20022/some-group/some-project.git
Using LDAP: yes
Using Omniauth: yes
Omniauth Providers: 

GitLab Shell
Version:  11.0.0
Repository storage paths:
- default:  /var/opt/gitlab/git-data/repositories
GitLab Shell path:    /opt/gitlab/embedded/service/gitlab-shell
Git:    /opt/gitlab/embedded/bin/git

GitLab应用检查结果

展开与GitLab应用程序检查相关的输出


root@git:/# gitlab-rake gitlab:check SANITIZE=true

Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 11.0.0 ? ... OK (11.0.0)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Internal API available: OK
Redis available via internal API: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Checking Reply by email ...

IMAP server credentials are correct? ... yes
Init.d configured correctly? ... skipped
MailRoom running? ... skipped

Checking Reply by email ... Finished


Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... Server: ldapmain
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)
  User output sanitized. Found 8 users of 100 limit.

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Projects have namespace: ... 
3/1 ... yes
3/2 ... yes
3/4 ... yes
3/7 ... yes
3/8 ... yes
3/10 ... yes
3/23 ... yes
3/24 ... yes
3/25 ... yes
11/33 ... yes
12/34 ... yes
3/35 ... yes
3/47 ... yes
3/48 ... yes
3/54 ... yes
3/60 ... yes
3/63 ... yes
2/64 ... yes
3/65 ... yes
3/66 ... yes
3/67 ... yes
3/69 ... yes
18/71 ... yes
18/72 ... yes
3/73 ... yes
2/74 ... yes
3/75 ... yes
19/76 ... yes
21/78 ... yes
3/82 ... yes
24/83 ... yes
18/84 ... yes
16/85 ... yes
18/86 ... yes
25/87 ... yes
18/88 ... yes
3/89 ... yes
25/90 ... yes
25/91 ... yes
25/100 ... yes
25/101 ... yes
18/102 ... yes
17/105 ... yes
17/107 ... yes
17/108 ... yes
3/110 ... yes
27/111 ... yes
3/112 ... yes
25/114 ... yes
27/115 ... yes
27/116 ... yes
3/117 ... yes
29/118 ... yes
25/119 ... yes
25/120 ... yes
26/121 ... yes
27/122 ... yes
3/124 ... yes
2/125 ... yes
3/126 ... yes
3/127 ... yes
18/129 ... yes
3/132 ... yes
35/133 ... yes
31/134 ... yes
31/136 ... yes
31/137 ... yes
3/138 ... yes
2/139 ... yes
3/140 ... yes
3/141 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.5.3 ? ... yes (2.6.5)
Git version >= 2.22.0 ? ... yes (2.24.1)
Git user has default SSH configuration? ... yes
Active users: ... 10
Is authorized keys file accessible? ... yes

Checking GitLab App ... Finished


Checking GitLab subtasks ... Finished


问题

我还尝试按照their documentation的说明在DOCKER_TLS_CERTDIR=""中添加.gitlab-ci.yml,现在再也无法启动docker服务了。

升级

我刚刚升级到最新的gitlab-ce版本,但没有帮助:

GitLab12.8.2 (785e16f105a)
GitLab Shell11.0.0
GitLab Workhorsev8.21.0
GitLab APIv4
GitLab Pages1.16.0
Ruby2.6.5p114
Rails6.0.2
PostgreSQL10.12

最近有什么变化吗?

0 个答案:

没有答案