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

docker-compose up –abort-on-container-exit: UnicodeDecodeError: 'ascii' #3806

Closed
datpham23 opened this issue Aug 3, 2016 · 12 comments
Closed

Comments

@datpham23
Copy link

datpham23 commented Aug 3, 2016

docker-compose up works fine but with --abort-on-container-exit i'm getting the following error.

docker-compose.yml

version: '2'
services:
   app:
    build: .
    image: app
    ports:
     - "4000:4000"
    depends_on:
     - rethinkdb
  rethinkdb:
    image: rethinkdb
    ports:
     - "8080:8080"
     - "28015:28015"
     - "29015:29015"
docker-compose up --abort-on-container-exit
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "compose/cli/main.py", line 61, in main
  File "compose/cli/main.py", line 113, in perform_command
  File "compose/cli/main.py", line 835, in up
  File "compose/project.py", line 379, in up
  File "compose/project.py", line 177, in get_services_without_duplicate
  File "compose/project.py", line 165, in get_services
  File "compose/project.py", line 136, in get_service
  File "compose/project.py", line 555, in __init__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)
docker-compose returned -1

macos 10.11.5
Docker version 1.12.0, build 8eab29e
docker-compose version 1.8.0, build f3628c7

@aanand
Copy link

aanand commented Aug 3, 2016

First off, it looks like your YAML has an indentation problem - app is indented by 3 spaces, but rethinkdb by 2.

Secondly, that's a really strange problem and I can't reproduce it. Are you absolutely sure it's the --abort-on-container-exit flag that's causing it?

@dattran-vn01
Copy link

I think your YAML has problem with special characters (hidden characters?), make sure that service name does not contains special characters ('ascii' codec can't decode byte 0xe2). From debug info, I see docker compose cannot find service via name and raise NoSuchService exception (line 555, project.py)

@mjdavies
Copy link

We're starting to see this error now, same mac versions and docker versions, we're using docker for mac though.

We're not using --abort-on-container-exit and we're seeing it on multiple projects, who's docker-compose files work fine on other machines with the same docker and mac versions.

Anyone got any other ideas?

@mhockelberg
Copy link

mhockelberg commented Sep 2, 2016

I am seeing this error with just a simple docker-compose up. Using Docker Toolbox on my Mac 10.11.6 (15G1004).

Docker version 1.12.0, build 8eab29e
docker-compose version 1.8.0, build f3628c7
VirtualBox Version 5.0.24 r108355
Python 2.7.12

ERROR: for ssg 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)
Traceback (most recent call last):
File "", line 3, in
File "compose/cli/main.py", line 61, in main
File "compose/cli/main.py", line 113, in perform_command
File "compose/cli/main.py", line 835, in up
File "compose/project.py", line 400, in up
File "compose/parallel.py", line 64, in parallel_execute
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)
docker-compose returned -1

This just started happening this week. The only change that to this machine that I am aware of is the Sept 1 Mac Security update that was installed today (Security Update 2016-001 El Capitan and Security Update 2016-005 Yosemite).

Any help is appreciated.

NOTE: I had the same error with Docker for Mac - tested on both Docker Toolbox and Docker for Mac after I realized there was an issue.

Monica

@mjdavies
Copy link

mjdavies commented Sep 2, 2016

@mhockelberg We completely removed all docker apps, then reinstalled everything, and it still didn't work. Then we ran the reset option from within the preferences for docker for mac and it all worked again.

I'd try using the reset option if you can first, as that may have been all that we needed to do.

No idea what the actual problem is though.

@korbai
Copy link

korbai commented Oct 29, 2016

I have a similar problem. If my docker-compose.yml contains any non ASCII characters in comments AND I tried to docker-compose start from bash script via SSH on remote server I got UnicodeDecodeError. BUT when I did it from ssh shell there is no error.

Linux arch64 4.8.4-1-ARCH #1 SMP PREEMPT Sat Oct 22 18:26:57 CEST 2016 x86_64 GNU/Linux
Docker version 1.12.3, build 6b644ec
docker-compose version 1.8.1, build 878cff1

@flozero
Copy link

flozero commented Dec 6, 2017

got the same issue here my docker config

version: "2"

services:

  db-mongo:
    image: launcher.gcr.io/google/mongodb3
    ports:
      - "27017"

  redis-master:
    image: gcr.io/google_containers/redis:e2e 
    ports:
      - "6379"

  # redis-slave:
  #   image: gcr.io/google_samples/gb-redisslave:v1
  #   ports:
  #     - "6379"
  #   environment:
  #     - GET_HOSTS_FROM=dns

  us-user:
    image: xtechforce/node-alpine-dev
    env_file: ./service/us-user/.env
    command : npm run dev
    ports:
      - "30001:8080"
      - "30002:9229"
    depends_on:
      - db-mongo
    volumes:
      - ./service/us-user/:/app

  us-order:
    image: xtechforce/node-alpine-dev
    env_file: ./service/us-order/.env
    command : npm run dev
    ports:
      - "30003:8080"
      - "30004:9229"
    depends_on:
      - db-mongo
    volumes:
      - ./service/us-order/:/app

  us-product:
    image: xtechforce/node-alpine-dev
    env_file: ./service/us-product/.env
    command : npm run dev
    ports:
      - "30005:8080"
      - "30006:9229"
    depends_on:
      - db-mongo
    volumes:
      - ./service/us-product/:/app

  us-admin:
    image: xtechforce/node-alpine-dev
    env_file: ./service/us-admin/.env
    command : npm run dev
    ports:
      - "30007:8080"
      - "30008:9229"
    depends_on:
      - db-mongo
    volumes:
      - ./service/us-admin/:/app

  ws-api :
    image: xtechforce/node-alpine-dev
    env_file: ./website/ws-api/.env
    command : npm run dev
    ports:
    - "30009:8080"
    - "30010:9229"
    depends_on:
      - db-mongo
      - redis-master
      - us-user
      - us-order
      - us-product
      - us-admin
      # - redis-slave
    volumes:
      - ./website/ws-api/:/app 

  ws-back:
    image: xtechforce/node-alpine-dev
    env_file: ./website/ws-back/.env
    command : npm run dev
    depends_on:
      - ws-api
    volumes:
      - ./website/ws-back/:/app
    ports:
      - "8000:8000"
      
  init-db:
    image: mongo:3.2.6
    links:
      - db-mongo
    volumes:
      - ./database/init:/init
    command: >
             sh -c '
             sleep 4
             && mongorestore --host db-mongo -d clicbeton /init/clicbeton
             && bash
             '

can't find the unicode ...

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 13: ordinal not in range(128)

@chris-aeviator
Copy link

same here on a fresh Arch Linux install :(

@chris-aeviator
Copy link

chris-aeviator commented Jan 25, 2018

I identified the illegal signs in my file by going to the position (vim -> :goto 868) and they look as following:

image

when removing those strings (see the question marks) docker-compose runs with no issue

@shin-
Copy link

shin- commented Jan 25, 2018

@chris-aeviator If you're able to share the version of the file that was causing the issue, it'd go a long way in helping fix the bug.

@korbai
Copy link

korbai commented Jan 26, 2018

I retested with the current version of compose and got the same error.

If my docker-compose.yml contains any non ASCII characters in comments AND I tried to docker-compose start from bash script via SSH on remote server I got UnicodeDecodeError. BUT when I did it from ssh shell there is no error.

compose file:
`
version: '2'

services:

e with accent: é

app:
image: hello-world
`
image

the error message:
Traceback (most recent call last): File "/usr/bin/docker-compose", line 11, in <module> load_entry_point('docker-compose==1.17.1', 'console_scripts', 'docker-compose')() File "/usr/lib/python3.6/site-packages/compose/cli/main.py", line 68, in main command() File "/usr/lib/python3.6/site-packages/compose/cli/main.py", line 118, in perform_command project = project_from_options('.', options) File "/usr/lib/python3.6/site-packages/compose/cli/command.py", line 37, in project_from_options override_dir=options.get('--project-directory'), File "/usr/lib/python3.6/site-packages/compose/cli/command.py", line 87, in get_project config_details = config.find(project_dir, config_path, environment, override_dir) File "/usr/lib/python3.6/site-packages/compose/config/config.py", line 274, in find [ConfigFile.from_filename(f) for f in filenames], File "/usr/lib/python3.6/site-packages/compose/config/config.py", line 274, in <listcomp> [ConfigFile.from_filename(f) for f in filenames], File "/usr/lib/python3.6/site-packages/compose/config/config.py", line 174, in from_filename return cls(filename, load_yaml(filename)) File "/usr/lib/python3.6/site-packages/compose/config/config.py", line 1303, in load_yaml return yaml.safe_load(fh) File "/usr/lib/python3.6/site-packages/yaml/__init__.py", line 94, in safe_load return load(stream, SafeLoader) File "/usr/lib/python3.6/site-packages/yaml/__init__.py", line 70, in load loader = Loader(stream) File "/usr/lib/python3.6/site-packages/yaml/loader.py", line 24, in __init__ Reader.__init__(self, stream) File "/usr/lib/python3.6/site-packages/yaml/reader.py", line 85, in __init__ self.determine_encoding() File "/usr/lib/python3.6/site-packages/yaml/reader.py", line 124, in determine_encoding self.update_raw() File "/usr/lib/python3.6/site-packages/yaml/reader.py", line 178, in update_raw data = self.stream.read(size) File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 42: ordinal not in range(128)

versions:
`
Linux arch64 4.11.3-1-ARCH #1 SMP PREEMPT Sun May 28 10:40:17 CEST 2017 x86_64 GNU/Linux

Docker version 17.11.0-ce, build 1caf76ce6b

docker-compose version 1.17.1, build unknown
`

@shin-
Copy link

shin- commented Mar 28, 2018

Should be fixed by #5833

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

No branches or pull requests

9 participants