Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"KeyError: u'status'" with 1.7.0rc1 and swarm #3316

Closed
jamshid opened this issue Apr 13, 2016 · 7 comments
Closed

"KeyError: u'status'" with 1.7.0rc1 and swarm #3316

jamshid opened this issue Apr 13, 2016 · 7 comments
Milestone

Comments

@jamshid
Copy link

jamshid commented Apr 13, 2016

I just set up a two-node docker swarm and get the below error when running "docker-compose up" on the below test.yml (it just verifies some services are available to docker).

Those url's are fine and curl's succeed. I don't know why docker-compose is reporting KeyError.

verbose.txt

...
Exception in thread Thread-3:
Traceback (most recent call last):
  File "threading.py", line 810, in __bootstrap_inner
  File "threading.py", line 763, in run
  File "compose/cli/log_printer.py", line 190, in watch_events
  File "compose/project.py", line 344, in events
KeyError: u'status'

buildenv_test_1 exited with code 0
version: '2'

services:
  test:
    image: centos
    command: bash -e -c "set -o pipefail ; cat /etc/resolv.conf ;
              for url in
                  http://${DOCKER_BUILD_CACHE_HOST}:3142/acng-report.html
                  http://${DOCKER_BUILD_CACHE_HOST}:8181/starwars
                  http://${DOCKER_BUILD_CACHE_HOST}:8123
                  http://${DOCKER_BUILD_CACHE_HOST}:8081
                  http://${DOCKER_BUILD_CACHE_HOST}:8181
                  https://bitbucket.org
                  https://google.com
                  ; do
                  echo Verfiying $${url} ;
                  curl -I -fsS $${url} | grep -i -E 'HTTP/|Server:' | sed 's/^/^   /g' ||
                       { echo FAILED ; exit 1 ; } ;
              done ;
              echo 'Verifying curl dl.fedoraproject.org' ;
              curl -I -fsSL http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm | grep -i -E 'HTTP/|Server:' | sed 's/^/^   /g' || { echo FAILED ; exit 1 ; } ;
              echo 'Verifying curl -x dl.fedoraproject.org' ;
              curl -I -fsSL -x 'http://${DOCKER_BUILD_CACHE_HOST}:8123' -H Cache-control:no-cache http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm | grep -i -E 'HTTP/|Server:' | sed 's/^/^   /g' || { echo FAILED ; exit 1 ; } ;
              echo SUCCESS"
$ docker info
Containers: 32
 Running: 13
 Paused: 0
 Stopped: 19
Images: 120
Server Version: swarm/1.1.3
Role: primary
Strategy: spread
Filters: health, port, dependency, affinity, constraint
Nodes: 2
 61: 192.168.2.61:2375
  └ Status: Healthy
  └ Containers: 16
  └ Reserved CPUs: 0 / 4
  └ Reserved Memory: 0 B / 16.42 GiB
  └ Labels: executiondriver=native-0.2, kernelversion=3.16.0-4-amd64, operatingsystem=Debian GNU/Linux 8 (jessie), provider=generic, storagedriver=aufs
  └ Error: (none)
  └ UpdatedAt: 2016-04-13T04:26:21Z
 62: 192.168.2.62:2375
  └ Status: Healthy
  └ Containers: 16
  └ Reserved CPUs: 0 / 4
  └ Reserved Memory: 0 B / 16.37 GiB
  └ Labels: executiondriver=native-0.2, kernelversion=3.16.0-4-amd64, operatingsystem=Debian GNU/Linux 8 (jessie), provider=generic, storagedriver=aufs
  └ Error: (none)
  └ UpdatedAt: 2016-04-13T04:26:04Z
Plugins: 
 Volume: 
 Network: 
Kernel Version: 3.16.0-4-amd64
Operating System: linux
Architecture: amd64
CPUs: 8
Total Memory: 32.79 GiB
Name: 34bfb34eec2a
@dnephin dnephin added the swarm label Apr 13, 2016
@dnephin
Copy link

dnephin commented Apr 13, 2016

It looks like swarm is not properly supporting the old API response format. I believe this is a swarm bug, since it works with Engine.

@jfchevrette
Copy link

I am having the same issue with the latest docker/compose/swarm releases. This seems to occur when a service container exits prematurely with doing compose up

docker 1.11.0
swarm 1.2.0

docker-compose version 1.7.0
docker-py version: 1.8.0
CPython version: 2.7.10
OpenSSL version: OpenSSL 0.9.8zh 14 Jan 2016

docker-compose up --build

[ ...build stuff... ]

db_1   | Version: '10.1.12-MariaDB'  socket: '/var/lib/mysql/mysqld.sock'  port: 0  MariaDB Server
db_1   | /docker-entrypoint.sh: line 61: pwgen: command not found
demo_db_1 exited with code 127
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/Cellar/docker-compose/1.7.0/libexec/lib/python2.7/site-packages/compose/cli/log_printer.py", line 190, in watch_events
    for event in event_stream:
  File "/usr/local/Cellar/docker-compose/1.7.0/libexec/lib/python2.7/site-packages/compose/project.py", line 345, in events
    if event['status'] in IMAGE_EVENTS:
KeyError: u'status'

@dnephin dnephin added this to the 1.7.1 milestone Apr 15, 2016
@dnephin
Copy link

dnephin commented Apr 15, 2016

I think this is still a bug in swarm, so it should be ticketed there as well, but we may be able to work around it in Compose by just skipping events that don't have a status.

@jamshid
Copy link
Author

jamshid commented Apr 17, 2016

Thanks, this problem appears to have been resolved by the swarm image dated 2016-04-13T17:25:03.059294066Z. After doing a "docker pull swarm" and restarting the swarm containers, I no longer see the KeyError: u'status' error.

@jamshid jamshid closed this as completed Apr 17, 2016
@jamshid
Copy link
Author

jamshid commented Apr 17, 2016

Sorry I shouldn't have closed it, I am still seeing the error when using latest swarm.

@jamshid jamshid reopened this Apr 17, 2016
@jpetazzo
Copy link

If you need to reproduce this issue:

docker-compose -f- up <<EOF
hello:
  image: alpine
  command: echo hello
EOF

I'm currently running those versions:

$ docker-compose -v
docker-compose version 1.7.0, build 0d7bf73
$ docker version
Client:
 Version:      1.11.0
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   4dc5990
 Built:        Wed Apr 13 18:38:59 2016
 OS/Arch:      linux/amd64

Server:
 Version:      swarm/1.2.0
 API version:  1.22
 Go version:   go1.5.4
 Git commit:   a6c1f14
 Built:        Wed Apr 13 05:58:31 UTC 2016
 OS/Arch:      linux/amd64

@shin-
Copy link

shin- commented Apr 30, 2016

FIxed by #3385

@shin- shin- closed this as completed Apr 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants