简体   繁体   English

在docker gitlab-ci-runner上运行docker-compose

[英]Running docker-compose on a docker gitlab-ci-multi-runner

I have a project running on Docker with docker-compose for dev environment. 我在Docker上运行了一个带有docker-compose for dev环境的项目。

I want to get it running on GitLabCI with a gitlab-ci-multi-runner "Docker mode" instance. 我想通过gitlab-ci-multi-runner“Docker mode”实例在GitLabCI上运行它。

Here is my .gitlab-ci.yml file: 这是我的.gitlab-ci.yml文件:

image: soullivaneuh/docker-bash

before_script:
  - apk add --update bash curl
  - curl --silent --location https://github.com/docker/compose/releases/download/1.5.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
  - chmod +x /usr/local/bin/docker-compose
  - ./configure
  - docker-compose up -d

Note that soullivaneuh/docker-bash image is just a docker image with bash installed. 请注意, soullivaneuh / docker-bash图像只是安装了bash的docker镜像。

The script fails on docker-compose up -d command: 脚本在docker-compose up -d命令上失败:

gitlab-ci-multi-runner 0.7.2 (998cf5d)
Using Docker executor with image soullivaneuh/docker-bash ...
Pulling docker image soullivaneuh/docker-bash:latest ...

Running on runner-1ee5079f-project-3-concurrent-1 via sd-59984...
Fetching changes...
Removing app/config/parameters.yml
Removing docker-compose.env
HEAD is now at 5c5e7ff remove docker service
From https://git.dummy.net/project/project
   5c5e7ff..45e643d  docker-ci  -> origin/docker-ci
Checking out 45e643dd as docker-ci...
Previous HEAD position was 5c5e7ff... remove docker service
HEAD is now at 45e643d... Remove docker info commands

$ apk add --update bash curl
fetch http://dl-4.alpinelinux.org/alpine/v3.2/main/x86_64/APKINDEX.tar.gz
OK: 10 MiB in 28 packages
$ curl --silent --location https://github.com/docker/compose/releases/download/1.5.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
$ chmod +x /usr/local/bin/docker-compose
$ ./configure
$ docker-compose up -d
bash: line 30: /usr/local/bin/docker-compose: No such file or directory

ERROR: Build failed with: exit code 1

I have absolutly no idea why this is failing. 我绝对不知道为什么会失败。

Thanks for help. 感谢帮助。

The No such file or directory is misleading. No such file or directory具有误导性。 I've received that many times while trying to run dynamically linked binaries using alpine linux (which it appears you are using). 我尝试使用alpine linux运行动态链接二进制文件时已经收到了很多次(看起来你正在使用它)。

The problem (as I understand it) is that the binary was compiled and linked against glibc, but alpine uses musl, not glibc. 问题(据我所知)是二进制编译并链接到glibc,但alpine使用musl,而不是glibc。

You could use ldd /usr/local/bin/docker-compose to tell you which libraries are missing (or run it with strace if all else fails). 您可以使用ldd /usr/local/bin/docker-compose告诉您哪些库丢失(或者如果其他所有文件都失败则使用strace运行它)。

To get it working, it might be easier to install from python source ( https://docs.docker.com/compose/install/#install-using-pip ), which is what the official compose image does ( https://github.com/docker/compose/blob/master/Dockerfile.run ). 为了使它工作,可能更容易从python源安装( https://docs.docker.com/compose/install/#install-using-pip ),这是官方撰写的图像( https:// github.com/docker/compose/blob/master/Dockerfile.run )。

Or you could use an image built on debian or some other distro that uses glibc. 或者你可以使用在debian或其他使用glibc的发行版上构建的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM