Harpreet Singh
Harpreet Singh

Reputation: 55

docker-compose up giving error UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

I am running my nodejs and blockchain code . And I made a Docker Container with dockerfile and docker compose but i am getting error while running the docker-compose up.

This is the traceback on console :

Traceback (most recent call last):
  File "docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 68, in main
  File "compose/cli/main.py", line 121, in perform_command
  File "compose/cli/main.py", line 938, in up
  File "compose/project.py", line 430, in up
  File "compose/service.py", line 317, in ensure_image_exists
  File "compose/service.py", line 918, in build
  File "site-packages/docker/api/build.py", line 238, in build
  File "site-packages/docker/api/build.py", line 285, in _set_auth_headers
  File "site-packages/docker/auth.py", line 97, in resolve_authconfig
  File "site-packages/docker/auth.py", line 125, in _resolve_authconfig_credstore
  File "site-packages/dockerpycreds/store.py", line 25, in get
  File "site-packages/dockerpycreds/store.py", line 57, in _execute
  File "subprocess.py", line 711, in __init__
  File "subprocess.py", line 1343, in _execute_child
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)
Failed to execute script docker-compose

and my docker-compose.yml is :

version: '2'
services:
  node-app:
    build: app
    ports:
      - "4000:8080"
    volumes:
      - ./app/src:/myapp/src
    depends_on:
      - ethernet_server
    environment:
      - ETHEREUM_CLIENT_IP=http://192.168.178.22
      - ETHEREUM_CLIENT_PORT=8545

  ethernet_server:
    build: testrpc

I don't know what went wrong.can someone help me to fix it?

Upvotes: 3

Views: 6825

Answers (3)

mabiyan
mabiyan

Reputation: 714

In my case, while saving docker commands i had saved it as a .odt file initially and then changed the file extension in finder app to .yml manually, resulted in above issue.

Used VS code (you can use any other tool or simply select all files as format type while saving) to save the file with .yml extension and then tried executing docker-compose again worked for me.

Upvotes: 0

Anmol Narang
Anmol Narang

Reputation: 551

Paste the below mentioned lines in your docker file. And it will fix the unicode error.

RUN apt-get update -y
RUN apt-get install --reinstall -y locales
# uncomment chosen locale to enable it's generation
RUN sed -i 's/# pl_PL.UTF-8 UTF-8/pl_PL.UTF-8 UTF-8/' /etc/locale.gen
# generate chosen locale
RUN locale-gen pl_PL.UTF-8
# set system-wide locale settings 
ENV LANG pl_PL.UTF-8
ENV LANGUAGE pl_PL
ENV LC_ALL pl_PL.UTF-8

Upvotes: 5

Eric Woods
Eric Woods

Reputation: 319

Try building the containers directly with docker:

docker build app

docker build testrpc

then run your docker-compose again.

I was encountering a similar report from docker-compose of UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0 and found that using docker to rebuild my containers resolved the problem.

Upvotes: 1

Related Questions