tmaier / docker-compose

Container with Docker + Docker Compose - good for CI
https://hub.docker.com/r/tmaier/docker-compose/
MIT License
152 stars 50 forks source link

Using docker:dind cannot get from gitlab registry with docker-compose up #13

Closed fergyfresh closed 6 years ago

fergyfresh commented 6 years ago
Running with gitlab-runner 11.4.0~beta.754.gad3eebfd (ad3eebfd)
  on docker-auto-scale 72989761
Using Docker executor with image tmaier/docker-compose:latest ...
Starting service docker:dind ...
Pulling docker image docker:dind ...
Using docker image sha256:redacted for docker:dind ...
Waiting for services to be up and running...
Pulling docker image tmaier/docker-compose:latest ...
Using docker image sha256:73454f3a9698ceb448cd79b2ef058607fbd310dce48b7dbb1050d2b00ecc6ea4 for tmaier/docker-compose:latest ...
Running on runner-72989761-project-7091190-concurrent-0 via runner-72989761-srm-1539035673-ce38e01b...
Cloning repository...
Cloning into '/example/redacted'...
Checking out example as redacted...
Skipping Git submodules setup
$ cd docker/compose/
$ docker-compose up
Creating network "compose_default" with the default driver
Pulling example-redacted...
Get https://registry.gitlab.com//example/redacted: denied: access forbidden
ERROR: Job failed: exit code 1

I can pull and push docker containers in gitlab ci, but when i use this latest container i cannot push/pull with gitlab's newest runner updates.

tmaier commented 6 years ago

Hi,

can you please show me the relevant part of your .gitlab-ci.yml?

This is how the relevant part looks in my case:


.docker: &docker
  image: tmaier/docker-compose:latest
  services:
    - docker:dind
  before_script:
    - |
      if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
        export DOCKER_HOST='tcp://localhost:2375'
      fi
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
    - printenv >> .env.test
  variables: &docker_variables
    DOCKER_DRIVER: overlay2
fergyfresh commented 6 years ago

Looks almost the same, only different is I don't have that bash if statement.

Also I think my DOCKER_HOST=tcp://docker:2375, which used to work about 3 weeks ago.

fergyfresh commented 6 years ago

Very interesting though, I appreciate the quick feedback. I already have some things to try and I'm excited to get to the bottom of this.

fergyfresh commented 6 years ago

THAT WORKED!!!!! Using your

  before_script:
    - |
      if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
        export DOCKER_HOST='tcp://localhost:2375'
      fi

I had DOCKER_HOST set to tcp://docker:2375, like I did for the non-docker-compose stuff, but for some reason that environment variable was blank here.

But it 100% worked like a month ago, did you recently implement this workaround?

tmaier commented 6 years ago

I use this for quite some time. It is relevant when the runner uses kubernetes instead of docker-machine or plain docker. So it depends on which gitlab-runner you use...

fergyfresh commented 6 years ago

I see. But I am seeing this issue using gitlab-runner on gitlab itself using version gitlab-runner-11.4.0.rc1

tmaier commented 6 years ago

I don’t know. Maybe they use kubernetes as well.. this would actually make sense, as they moved to Google Cloud.

Is there any topic left or can we close this issue?