Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running docker-compose on a docker gitlab-ci-multi-runner

I have a project running on Docker with docker-compose for dev environment.

I want to get it running on GitLabCI with a gitlab-ci-multi-runner "Docker mode" instance.

Here is my .gitlab-ci.yml file:

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.

The script fails on docker-compose up -d command:

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.

like image 220
Soullivaneuh Avatar asked Dec 23 '15 15:12

Soullivaneuh


1 Answers

The No such file or directory is misleading. I've received that many times while trying to run dynamically linked binaries using alpine linux (which it appears you are using).

The problem (as I understand it) is that the binary was compiled and linked against glibc, but alpine uses musl, not 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).

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).

Or you could use an image built on debian or some other distro that uses glibc.

like image 112
dnephin Avatar answered Nov 13 '22 23:11

dnephin