docker-compose up给出错误UnicodeDecodeError:' ascii'编解码器不能解码位置0中的字节0xe2:序数不在范围内(128)

时间:2017-10-30 11:12:15

标签: docker containers docker-compose

我正在运行我的nodejs和区块链代码。我使用dockerfile和docker compose创建了一个Docker容器,但是在运行docker-compose时遇到了错误。

这是控制台上的回溯:



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
&#13;
&#13;
&#13;

我的docker-compose.yml是:

&#13;
&#13;
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
&#13;
&#13;
&#13;

我不知道出了什么问题。有人帮我解决了吗?

2 个答案:

答案 0 :(得分:2)

尝试使用docker直接构建容器:

docker build app

docker build testrpc

然后再次运行docker-compose

我遇到了来自UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0的docker-compose的类似报告,发现使用docker重建我的容器解决了这个问题。

答案 1 :(得分:0)

将以下提到的行粘贴到docker文件中。它将解决unicode错误。

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