docker / compose

Define and run multi-container applications with Docker
https://docs.docker.com/compose/
Apache License 2.0
34.02k stars 5.23k forks source link

"docker-compose logs | head" breaks and leaves container running #3147

Closed glinders closed 5 years ago

glinders commented 8 years ago

I get the following error:

$ docker-compose logs | head
Attaching to dockerregistry_nginx_1, dockerregistry_registry_1
nginx_1    | 192.168.12.165 - - [16/Mar/2016:18:10:27 +0000] "GET /v2/_catalog HTTP/1.1" 200 54 "-" "curl/7.35.0" "-"
nginx_1    | 192.168.12.171 - - [16/Mar/2016:18:11:29 +0000] "DELETE /v2/test-image/manifests/sha256:09de1cdf2a26692e344cdf4a5265c11760689ec32176405e996d16a0089ff02e HTTP/1.1" 202 0 "-" "Go-http-client/1.1" "-"
nginx_1    | 192.168.12.165 - - [16/Mar/2016:18:11:44 +0000] "GET /v2/_catalog HTTP/1.1" 200 54 "-" "curl/7.35.0" "-"
nginx_1    | 192.168.12.165 - - [16/Mar/2016:18:20:09 +0000] "GET /v2/_catalog HTTP/1.1" 200 33 "-" "curl/7.35.0" "-"
registry_1 | time="2016-03-16T18:10:15Z" level=warning msg="No HTTP secret provided - generated random secret. This may cause problems with uploads if multiple registries are behind a load-balancer. To provide a shared secret, fill in http.secret in the configuration file or set the REGISTRY_HTTP_SECRET environment variable." go.version=go1.5.3 instance.id=5975c60a-8a40-4311-a2c3-84c2ad06bf6b version=v2.3.1 
registry_1 | time="2016-03-16T18:10:15Z" level=info msg="redis not configured" go.version=go1.5.3 instance.id=5975c60a-8a40-4311-a2c3-84c2ad06bf6b version=v2.3.1 
registry_1 | time="2016-03-16T18:10:15Z" level=info msg="using inmemory blob descriptor cache" go.version=go1.5.3 instance.id=5975c60a-8a40-4311-a2c3-84c2ad06bf6b version=v2.3.1 
registry_1 | time="2016-03-16T18:10:15Z" level=info msg="listening on [::]:5000" go.version=go1.5.3 instance.id=5975c60a-8a40-4311-a2c3-84c2ad06bf6b version=v2.3.1 
Error deleting container: Error response from daemon: Conflict, You cannot remove a running container. Stop the container before attempting removal or use -f
write /dev/stdout: broken pipe

Instead of deleting the docker-compose container (as it normally does), it leaves it running:

$ docker ps
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                         NAMES
f16af534f643        docker/compose:1.6.2   "/usr/bin/docker-comp"   4 seconds ago       Up 4 seconds                                      stoic_darwin
dnephin commented 8 years ago

Interesting. This might have been fixed by e6a675f338a895d93208d1f291d1cee901bf0e32 which was not in 1.6.2. You can try out the current script here: https://github.com/docker/compose/blob/master/script/run/run.sh to see if that fixes the issue for you.

If it doesn't I'm not sure what we can do about it.

glinders commented 8 years ago

That's the same version I'm using: I've diffed both files and they are the same.

dnephin commented 8 years ago

I'm not sure how to solve this. The last line of that script is exec docker run, so it should be up to the docker cli to do the right thing. I wonder if we can reproduce this problem running a different image with a similar container config.