compose icon indicating copy to clipboard operation
compose copied to clipboard

docker-compose build hangs

Open bfallik opened this issue 9 years ago • 79 comments

$ docker version
Client:
 Version:      1.13.0
 API version:  1.24 (downgraded from 1.25)
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Wed Jan 18 16:20:26 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      1.12.6
 API version:  1.24 (minimum version )
 Go version:   go1.6.3
 Git commit:   d5236f0
 Built:        Fri Jan 20 05:47:10 2017
 OS/Arch:      linux/amd64
 Experimental: false

I'm trying to use docker-compose build but the command hangs:

$ docker-compose build --force-rm
Building integration-test-go
^CERROR: Aborting.

docker-compose.yml contains

version: '2'
services:
  integration-test-go:
    build:
      context: go
      dockerfile: go/Dockerfile

and go/.dockerignore has

bin/
coverage/

The same invocation via docker build completes in about a minute:

$ time docker build --force-rm=true go
...
Step 10 : ADD ./Makefile $GOPATH/Makefile
 ---> 7291ce227751
Removing intermediate container e69e54d81655
Step 11 : ADD ./src/ $GOPATH/src/
 ---> 690cf13fd4ae
Removing intermediate container 9649280eddff
Successfully built 690cf13fd4ae

real	1m49.268s
user	0m3.688s
sys	0m2.501s

Any idea what's going on here?

bfallik avatar Jan 27 '17 01:01 bfallik

Can you try again with --verbose and share the output?

shin- avatar Jan 27 '17 20:01 shin-

As well as the output of docker-compose version

shin- avatar Jan 27 '17 20:01 shin-

@shin-

$ docker-compose --version
docker-compose version 1.10.0, build 4bd6f1a

bfallik avatar Jan 27 '17 20:01 bfallik

@shin-

$ docker-compose --verbose build
compose.config.config.find: Using configuration files: ./../docker-compose.yml
docker.auth.find_config_file: Trying paths: ['/Users/bfallik/.docker/config.json', '/Users/bfallik/.dockercfg']
docker.auth.find_config_file: Found file at path: /Users/bfallik/.docker/config.json
docker.auth.load_config: Found 'auths' section
docker.auth.parse_auth: Found entry (registry=u'https://index.docker.io/v1/', username=u'bfallik')
docker.auth.parse_auth: Found entry (registry=u'https://468274692891.dkr.ecr.us-east-1.amazonaws.com', username=u'AWS')
compose.cli.command.get_client: docker-compose version 1.10.0, build 4bd6f1a
docker-py version: 2.0.1
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2j  26 Sep 2016
compose.cli.command.get_client: Docker base_url: http://localhost:2375
compose.cli.command.get_client: Docker version: KernelVersion=4.8.17-coreos, Os=linux, BuildTime=2017-01-20T05:47:10.598613119+00:00, ApiVersion=1.24, Version=1.12.6, GitCommit=d5236f0, Arch=amd64, GoVersion=go1.6.3
compose.service.build: Building go
compose.cli.verbose_proxy.proxy_callable: docker build <- (pull=False, stream=True, nocache=False, tag='go', buildargs=None, rm=True, forcerm=False, path='/Users/bfallik/sandbox/go', dockerfile='go/Dockerfile')

bfallik avatar Jan 27 '17 20:01 bfallik

@shin-

I've got the same issue, with the same --verbose output.

It seems both @bfallik and I are using AWS ECR.

docker.auth.find_config_file: Trying paths: ['<REDACTED>/.docker/config.json', '<REDACTED>/.dockercfg']
docker.auth.find_config_file: Found file at path: <REDACTED>/.docker/config.json
docker.auth.load_config: Found 'auths' section
docker.auth.parse_auth: Found entry (registry=u'https://index.docker.io/v1/', username=u'<REDACTED>')
docker.auth.parse_auth: Found entry (registry=u'https://<REDACTED>.dkr.ecr.ap-southeast-2.amazonaws.com', username=u'AWS')
docker.auth.parse_auth: Found entry (registry=u'<REDACTED>.dkr.ecr.ap-southeast-2.amazonaws.com', username=u'AWS')
compose.cli.command.get_client: docker-compose version 1.10.0, build 4bd6f1a
docker-py version: 2.0.1
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2j  26 Sep 2016
compose.cli.command.get_client: Docker base_url: http+docker://localunixsocket
compose.cli.command.get_client: Docker version: KernelVersion=4.9.4-moby, Arch=amd64, BuildTime=2017-01-18T16:20:26.924957224+00:00, ApiVersion=1.25, Version=1.13.0, MinAPIVersion=1.12, GitCommit=49bf474, Os=linux, Experimental=True, GoVersion=go1.7.3
compose.project.build: mongo uses an image, skipping
compose.service.build: Building api
compose.cli.verbose_proxy.proxy_callable: docker build <- (pull=False, stream=True, nocache=False, tag='<REDACTED>', buildargs=None, rm=True, forcerm=False, path='<REDACTED>/<REDACTED>/src/api', dockerfile=None)```

mrjackdavis avatar Jan 31 '17 03:01 mrjackdavis

Thanks for sharing. I must admit, I'm stumped - doesn't look like anything obvious is happening on the client side that would cause issues to occur while pulling.

Do you see anything relevant in the Docker daemon logs that could indicate a failure while processing the build request?

shin- avatar Feb 01 '17 22:02 shin-

@shin- I'm trying to follow them with syslog -w -k Sender Docker but I don't see much output when I invoke docker-compose. One line seems suspicious:

Feb  1 19:39:42 xxx Docker[1495] <Notice>: 127.0.0.1:0: dispatcher shutting down: read: Eof

Is there some other way I can view what's going on?

bfallik avatar Feb 02 '17 00:02 bfallik

@bfallik Here's what I do when I need to dig in

  1. Shut down running docker daemon (on Ubuntu, sudo service docker stop)
  2. Manually start dockerd with the debug flag (sudo dockerd --debug)
  3. Run docker-compose ... command in a separate term and watch logs

shin- avatar Feb 02 '17 01:02 shin-

@shin- Unfortunately I'm on OSX and I'm not as familiar with it as I might be with Linux. I don't see even a dockerd command available to me. I imagine it's buried somewhere in the Docker for Mac packaging.

bfallik avatar Feb 02 '17 01:02 bfallik

I'm less familiar with Mac OS and D4M, but I think you can add "debug": true in the daemon options as shown here, then get the logs the same way you were doing already.

shin- avatar Feb 02 '17 01:02 shin-

@shin- so this is weird.

When I restart the daemon with "debug": true I don't see any logging from docker-compose. Here's the output:

$ syslog -w -k Sender Docker
...
Feb  1 21:34:09 Brians-MBP-4 Docker[9044] <Notice>: Docker is not responding: Get http://./info: EOF: waiting 0.5s
Feb  1 21:34:09 Brians-MBP-4 Docker[9043] <Notice>: Using protocol TwoThousand msize 8192
Feb  1 21:34:11 Brians-MBP-4 Docker[9044] <Notice>: Docker is responding
Feb  1 21:34:11 Brians-MBP-4 Docker[1496] <Notice>: VM started at 2017-02-01 21:34:11 -0500 EST


^C
$ 

I added those newlines to note when Docker completed its startup and when I invoked docker-compose.

bfallik avatar Feb 02 '17 02:02 bfallik

It's as if my docker client isn't talking to that daemon but I don't have any DOCKER_HOST variable set:

$ env | grep -i docker
$

bfallik avatar Feb 02 '17 02:02 bfallik

Really odd. My colleague was able to build the project which I am unable to, on the same version of docker.

So far, I've tried:

  • Restore Docker to factory settings
  • Uninstall and install Docker
  • Remove ~/.docker/config.json

All to no avail.

mrjackdavis avatar Feb 02 '17 04:02 mrjackdavis

Sweet mother of god.

There's a SO post which mentions docker-compose build hangs when chrome is open (link)

My colleague was using Safari and his was working. I told him to open chrome and try again. It failed

Armed with this knowledge, I was able to fix by:

  1. Update Chrome
  2. Quit Chrome
  3. rm -rf <my repository>
  4. clone and setup repository
  5. docker-compose build 👍
  6. Open chrome
  7. docker-compose build 👍

What. On. Earth.

Update This did not last. When I rebooted docker, it started to hang again.

mrjackdavis avatar Feb 02 '17 05:02 mrjackdavis

@mrjackdavis that is super weird. I just tested docker-compose after killing Chrome but that didn't workaround my hang so maybe they're separate issues?

bfallik avatar Feb 02 '17 14:02 bfallik

@bfallik did you also try it on an empty repository?

I updated the fix in my previous comment

mrjackdavis avatar Feb 02 '17 22:02 mrjackdavis

@mrjackdavis No, what did you mean by an empty repository? Which repository?

bfallik avatar Feb 02 '17 22:02 bfallik

@bfallik Sorry - I wasn't clear.

I deleted my repository (my project files, with docker-compose.yml at the root). The entire folder. Then cloned it from remote. Do that right after quitting chrome.

mrjackdavis avatar Feb 03 '17 02:02 mrjackdavis

Is there an ETA for the fix for this? I haven't been able to use Docker for my projects for over a month now. The workaround to exit Chrome is ridiculous.

sschimmel avatar Mar 06 '17 10:03 sschimmel

Agreed. The chrome workaround isidiotic.

I've settled with a bash script which uses docker build directly. Terrible also, but better than the chrome fix.

mrjackdavis avatar Mar 06 '17 21:03 mrjackdavis