compose icon indicating copy to clipboard operation
compose copied to clipboard

TypeError: coercing to Unicode: need string or buffer, NoneType found

Open sstarcher opened this issue 11 years ago • 32 comments

The first time I do docker-compose up -d everything works The second time I get the following error

Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 460, in up
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 221, in up
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 261, in _get_convergence_plans
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 278, in convergence_plan
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 101, in containers
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.container", line 28, in from_ps
TypeError: coercing to Unicode: need string or buffer, NoneType found
docker-compose --version
docker-compose version: 1.3.1
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
docker info
Containers: 8
Images: 98
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 114
 Dirperm1 Supported: false
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.13.0-53-generic
Operating System: Ubuntu 14.04.2 LTS
CPUs: 1
Total Memory: 992.5 MiB
Name: ip-10-0-11-99
ID: 3RM6:3ZR5:FK7P:N6TM:CE35:2VFA:BUJ7:UDBR:IUDR:OSB7:7BP2:TEHS
WARNING: No swap limit support

sstarcher avatar Jun 24 '15 01:06 sstarcher

@sstarcher try downgrading to docker-compose v1.2.0

I've been having a similar issue with a php-fpm container. The root cause is the "affinity:container" ENV variable that is being added when docker-compose recreates containers.

See https://github.com/docker/compose/issues/1598 for details.

lmakarov avatar Jun 24 '15 20:06 lmakarov

+1

devinrsmith avatar Jun 24 '15 23:06 devinrsmith

@sstarcher @devinrsmith I can't reproduce. Could you paste your docker-compose.yml? Was it previously working with Compose 1.2 or is this your first time running it?

aanand avatar Jun 24 '15 23:06 aanand

@aanand I'll get you an example tomorrow. It happened on several of our servers with different docker compose files.

sstarcher avatar Jun 24 '15 23:06 sstarcher

It was previously working on 1.2. Broke on 1.3. Downgraded to 1.2, back and working.

devinrsmith avatar Jun 25 '15 00:06 devinrsmith

We see the same error from docker-compose 1.3.1 and docker 1.7.0 using AUFS. It's working for me, but exactly the same setup isn't working for my Greek colleague who gets the same error as in the issue. Downgrading to docker-compose 1.2.0 is one solution, but is there a better solution?

tomfotherby avatar Jun 26 '15 13:06 tomfotherby

I have the same issue. However, when I use docker-compose migrate-to-labels, the containers are created and started correctly.

mrijken avatar Jun 26 '15 19:06 mrijken

When I removed some old (dead and exited) containers, docker-compose up -d is working again.

mrijken avatar Jun 26 '15 19:06 mrijken

I might try to fix this tomorrow and submit a pull request (unless someone is already on it!)

prologic avatar Jun 29 '15 14:06 prologic

Same issue here, I was able to fix it by removing some dead containers, everything is going well again.

wayt avatar Jun 30 '15 15:06 wayt

b368272 at least tries to fix this; I'm not sure how get_container_name() should change for a "Dead" container though.

prologic avatar Jul 01 '15 11:07 prologic

docker-compose 1.3.1 docker 1.7.0

docker-compose.yml

{
  "image1": {
    "image": "ubuntu",
    "volumes": [
      "/:/logstashforwarder:ro"
    ],
    "command": "sleep 10000"
  },
  "image2": {
    "image": "ubuntu",
    "command": "sleep 10000",
    "volumes": [
      "/:/hostfs:ro"
    ]
  }
}

Run the following twice docker-compose up -d

Recreating opt_image2_1...
Cannot destroy container 982a0d62eab102811a5a697a3df2de46fad5c7acd34a9bb5bea44e98d47fb1ee: Driver aufs failed to remove root filesystem 982a0d62eab102811a5a697a3df2de46fad5c7acd34a9bb5bea44e98d47fb1ee: rename /var/lib/docker/aufs/mnt/982a0d62eab102811a5a697a3df2de46fad5c7acd34a9bb5bea44e98d47fb1ee /var/lib/docker/aufs/mnt/982a0d62eab102811a5a697a3df2de46fad5c7acd34a9bb5bea44e98d47fb1ee-removing: device or resource busy

Afterwards if you try docker-compose rm you will get

docker-compose rm
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 247, in rm
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 281, in containers
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.container", line 28, in from_ps
TypeError: coercing to Unicode: need string or buffer, NoneType found

sstarcher avatar Jul 01 '15 19:07 sstarcher

FWIW, confirmed with 1.3.3, rolling back to 1.2.0 indeed fixes the issue.

batmat avatar Jul 17 '15 13:07 batmat

@prologic Can you paste the JSON of a "Dead" container? I can't reproduce one locally. I'm also not sure what we should do if we can't determine a container's name.

aanand avatar Jul 17 '15 14:07 aanand

I get this error (1.3.3) when doing compose run --rm run bash. I have a service called run. Changing the service name works (e.g. runa).

This had been working (I think 1.3.0 was the last version I had - it was 1.3.something) up until now that I have 1.3.3.

ferdy-lw avatar Jul 21 '15 00:07 ferdy-lw

I can confirm this:

docker-compose up -d
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 32, in main
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 471, in up
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 230, in up
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 398, in remove_duplicate_containers
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 405, in duplicate_containers
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.service", line 112, in containers
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.legacy", line 56, in check_for_legacy_containers
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.legacy", line 138, in get_legacy_containers
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.legacy", line 152, in _get_legacy_containers_iter
TypeError: argument of type 'NoneType' is not iterable

Docker Compose

docker-compose --version
docker-compose version: 1.3.2
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013

Docker

docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d
OS/Arch (server): linux/amd64

docker-compose.yml

wildfly:
  build: ./sp
  ports:
    - "8080:8080"
    - "9990:9990"
    - "39331:8787"
  links:
    - mysql:db
  volumes:
    - ./volumes/remote_deploy:/opt/jboss/wildfly/standalone/deployments
    - ./volumes/sp_properties:/opt/jboss/wildfly/standalone/sp_properties

mysql:
  image: mysql
  environment:
    MYSQL_USER: mysql
    MYSQL_PASSWORD: mysql
    MYSQL_DATABASE: test

A rollback to 1.2.0 fixed the issue.

ErrorProne avatar Jul 22 '15 22:07 ErrorProne

I think same issue here:

# docker-compose logs
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 32, in main
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 34, in dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 66, in perform_command
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 158, in logs
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.project", line 301, in containers
  File "/code/build/docker-compose/out00-PYZ.pyz/compose.container", line 28, in from_ps
TypeError: coercing to Unicode: need string or buffer, NoneType found


# docker-compose --version
docker-compose version: 1.3.3
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013

pejvan avatar Jul 30 '15 01:07 pejvan

when docker-compose up -d <service_name> in progress (linked service starting) - same issue

$ docker-compose ps
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 9, in <module>
    load_entry_point('docker-compose==1.3.3', 'console_scripts', 'docker-compose')()
  File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 32, in main
    command.sys_dispatch()
  File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 21, in sys_dispatch
    self.dispatch(sys.argv[1:], None)
  File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 34, in dispatch
    super(Command, self).dispatch(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/compose/cli/docopt_command.py", line 24, in dispatch
    self.perform_command(*self.parse(argv, global_options))
  File "/usr/lib/python2.7/site-packages/compose/cli/command.py", line 66, in perform_command
    handler(project, command_options)
  File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 195, in ps
    project.containers(service_names=options['SERVICE'], stopped=True) +
  File "/usr/lib/python2.7/site-packages/compose/project.py", line 301, in containers
    filters={'label': self.labels(one_off=one_off)})]
  File "/usr/lib/python2.7/site-packages/compose/container.py", line 28, in from_ps
    'Name': '/' + get_container_name(dictionary),
TypeError: coercing to Unicode: need string or buffer, NoneType found

Versions

$ sudo docker version                                                                              
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d
OS/Arch (server): linux/amd64

sudo docker-compose --version                                                                    
docker-compose version: 1.3.3
CPython version: 2.7.10
OpenSSL version: OpenSSL 1.0.2d 9 Jul 2015

estin avatar Jul 30 '15 10:07 estin

we are receiving the same error with latest pip release

fnigi]# docker-compose -v dockdocker-compose version: 1.4.0rc2 fnigi]# docker -v Docker version 1.6.0, build 4749651

the same with version 1.7.1 and 1.3.3 od docker-compose

the same configuration work on an upgraded python env

on Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36) seem broken

nigifabio avatar Jul 30 '15 11:07 nigifabio