Compose: Docker-compose up fails in Gitlab CI with Exit code: 1

Created on 28 Jun 2017  路  6Comments  路  Source: docker/compose

Im trying to use docker-compose up -d in the Gitlab CI for deploying my project to a staging server hosted on Digital Ocean. The server has a gitlab CI runner installed.

When I run the command docker-compose up -d I get the non-descriptive traceback

ERROR: for nginx  expected string or buffer
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 68, in main
    command()
  File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 118, in perform_command
    handler(command, command_options)
  File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 926, in up
    scale_override=parse_scale_args(options['--scale']),
  File "/usr/lib/python2.7/site-packages/compose/project.py", line 424, in up
    get_deps
  File "/usr/lib/python2.7/site-packages/compose/parallel.py", line 69, in parallel_execute
    raise error_to_reraise
TypeError: expected string or buffer
ERROR: Job failed: exit code 1

All the other containers run properly with:

Creating foo_data_1 ... 
Creating foo_data_1

Creating foo_data_1 ... done
Creating foo_postgres_1 ... 
Creating foo_postgres_1

Creating foo_postgres_1 ... done
Creating foo_web_1 ... 
Creating foo_web_1

Creating foo_web_1 ... done

This is what my gitlab-ci.yml file looks like:

image: docker:latest
stages:
  - test
  - build
  - deploy

# When using dind, it's wise to use the overlayfs driver for
# improved performance.
variables:
  DOCKER_DRIVER: overlay

services:
  - docker:dind

before_script:
  - docker info
  - apk add --no-cache python py2-pip
  - pip install --no-cache-dir docker-compose
  - chmod +x /usr/local/bin/docker-compose
  - docker-compose -v

staging:
  stage: deploy
  script:
    - docker-compose build
    - docker-compose up -d

And I have followed the suggestions in this issue to no avail.

Most helpful comment

Same issue, some more info:

  1. This problem exists only on docker-compose v1.13.x - v1.14.x from pypi on any environment (Gitlab CI using dind, local laptop using arch linux with 4.11.x kernel, server with ubuntu 16.04)
  2. This problem does not exists if you use docker-compose in docker (hub.docker.com/r/docker/compose) or from system package manager (ubuntu)

@andrewgy8,
Workaround:

pip install docker-compose==1.12.0

All 6 comments

Same issue, some more info:

  1. This problem exists only on docker-compose v1.13.x - v1.14.x from pypi on any environment (Gitlab CI using dind, local laptop using arch linux with 4.11.x kernel, server with ubuntu 16.04)
  2. This problem does not exists if you use docker-compose in docker (hub.docker.com/r/docker/compose) or from system package manager (ubuntu)

@andrewgy8,
Workaround:

pip install docker-compose==1.12.0

@rakshazi Awesome, that worked like a charm. Just for future reference this the relevant part of my gitlab-ci.yml:

before_script:
  - docker info
  - apk add --no-cache python py2-pip
  - pip install --no-cache-dir docker-compose==1.12.0
  - docker-compose -v

staging:
  stage: deploy
  script:
    - docker-compose build
    - docker-compose up -d

Reopen issue, please. It's not fixed, it only has workaround.

Related to #4971

+1 debian jessie :(

Consolidating with #4972

Was this page helpful?
0 / 5 - 0 ratings