Docker executor fails when docker daemon log-opts is not json-file
I tried to install gitlab-ci-multi-runner with the docker executor on a computer where the docker daemon is configured with the --log-driver=fluentd
. The computer is running ubuntu 14.04 (64 bits) with docker 1.9.1 (from official debian package).
Any runner started on that computer fails with the following trace visible in the 'build' page:
gitlab-ci-multi-runner 0.7.2 (998cf5d)
Using Docker executor with image ruby:2.2 ...
Pulling docker image gitlab/gitlab-runner:cache ...
Pulling docker image gitlab/gitlab-runner:build ...
Pulling docker image ruby:2.2 ...
ERROR: Build failed with: Unrecognized input header
If I change the docker daemon options to use the default log-driver of json-file
then it works as expected.
I believe the reason is that the docker API call used to attach to the container to stream the logs only works with the json-file
or journald
log-drivers (as explained here: https://docs.docker.com/engine/reference/api/docker_remote_api_v1.20/#get-container-logs).
I then tried to configure my runner in /etc/gitlab-runner/config.toml
to explicitly set log-driver=json-file
line, but that option does not seem to be supported (the gitlab-runner daemon starts but the containers still have fluentd in their .HostConfig.LogConfig
attribute).
concurrent = 4
[[runners]]
url = "https://example.com/ci"
token = "xxxxxxxxxxxxxxxxxxxxxxxxx"
tls-skip-verify = false
tls-ca-file = ""
name = "myhost-ci1"
executor = "docker"
[runners.docker]
image = "ruby:2.2"
privileged = false
volumes = ["/cache"]
log-driver = "json-file"
Would it be possible to allow running the docker executor with the json-file driver when the docker daemon has a different default? I believe that this should be hardcoded in the executor because most custom logging drivers do not support tailing the logs.