環境
iMacでgitlab-runner+dockerを動かしてandroidアプリのCI環境を作っています。
gitlab-runnerは社内ランからしかアクセスできない設定で、CI環境の入っているiMacは社内にあります。
うまく動かない事例とそれぞれの対処法
使っていないイメージが多すぎて悪さをしている。
apt-get updateやapt-get installしているところで
Error writing to output file - write (28: No space left on device) [IP: xxx.xxx.xxx.xxx xx]
やら
W: Some index files failed to download. They have been ignored, or old ones used instead.
やら
Reading package lists...
Building dependency tree...
Reading state information...
Package file is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Unable to locate package lib32stdc++6
E: Couldn't find any package by regex 'lib32stdc++6'
E: Unable to locate package lib32z1
E: Unable to locate package aapt
E: Package 'file' has no installation candidate
やら出た時
→
dockerの動いているマシンのターミナルから
docker image prune
で使っていないイメージを消してやる。
WiFiなど、ネットワーク環境が悪い
サブモジュールなどを手動でgit cloneするところで
$ git clone http://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.xxxxx/hoge/hugahuga.git hugahuga
Cloning into 'hugahuga'...
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
と出た時
→
dockerの動いているマシンのWiFiが弱いのが原因っぽい。WiFiをつなぎなおしてやったり、ネットワーク環境を整えてやる。
gitlab-runnerやdockerがうまく動いていない。固まっている。
しょっぱなから
Running with gitlab-runner 12.2.0 (xxxxxxx)
on iMac-docker xxxxxx
ERROR: Preparation failed: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (executor_docker.go:983:120s)
Will be retried in 3s ...
ERROR: Preparation failed: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (executor_docker.go:983:120s)
Will be retried in 3s ...
ERROR: Preparation failed: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (executor_docker.go:983:120s)
Will be retried in 3s ...
ERROR: Job failed (system failure): Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (executor_docker.go:983:120s)
とか出てなにもできずにエラーになるとき
→dockerかgitlab-runnerのどちらかがうまく動いていないので、dockerとgitlab-runnerをそれぞれ再起動してやる。(本格的に固まっていてうんともすんとも言わずマシンの再起動になることも多々あり。)
DockerがPC内の必要なファイルにアクセスできていない
Running with gitlab-runner 12.2.0 (a987417a)
on iMac-docker xxxxxx
Using Docker executor with image xxx/hogehoge:latest ...
Pulling docker image xxx/hogehoge:latest ...
Using docker image sha256:××× for xxx/hogehoge:latest ...
ERROR: Job failed (system failure): Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (executor_docker.go:837:120s)
OSアップデート後にCIを走らせたらこういわれて失敗した。PCを開いて確認してみたら「Dockerがデスクトップ上のファイルにアクセスしようとしています」ようなことの書かれたダイアログが出ていて、OKを押してからCIを再度動かしたら成功したので、Dockerが必要なファイルへのアクセス権を持っていなかったのが原因っぽい。