compose icon indicating copy to clipboard operation
compose copied to clipboard

UnicodeDecodeError when executing docker-compose up

Open AmrElmasry opened this issue 8 years ago • 15 comments

when running docker-compose up This error happens:

  File "bin/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 "contextlib.py", line 35, in __exit__
  File "compose/cli/errors.py", line 53, in handle_connection_errors
  File "compose/cli/errors.py", line 118, in get_conn_error_message
  File "distutils/spawn.py", line 220, in find_executable
  File "posixpath.py", line 73, in join
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)
Failed to execute script docker-compose

Versions : docker-compose version 1.17.1, build 6d101fb Docker version 17.09.0-ce, build afdb6d4

On Ubuntu 16.04.3

locale

LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_US.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=

AmrElmasry avatar Dec 06 '17 11:12 AmrElmasry

Thanks for the report!

If you have a moment, can you try executing the script below and share the output as well?

#!/usr/bin/python
from distutils.spawn import find_executable

print find_executable(b'docker')
print find_executable(u'docker')

shin- avatar Dec 06 '17 22:12 shin-

Having the same issue described above, running version 1.18

File "docker-compose", line 6, in <module> File "compose\cli\main.py", line 71, in main File "compose\cli\main.py", line 121, in perform_command File "compose\cli\command.py", line 25, in project_from_options File "compose\config\environment.py", line 61, in from_env_file File "compose\config\environment.py", line 57, in _initialize File "compose\config\environment.py", line 36, in env_vars_from_file File "codecs.py", line 699, in next File "codecs.py", line 630, in next File "codecs.py", line 545, in readline File "codecs.py", line 492, in read File "encodings\utf_8_sig.py", line 104, in decode UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0: invalid start byte Failed to execute script docker-compose

Versions: Docker version 17.12.0-ce, build c97c6d6 docker-compose version 1.18.0, build 8dd22a96

running on windows 10

GuyFliess avatar Jan 20 '18 16:01 GuyFliess

Looks like your .env file isn't encoded properly. Please make sure you're using utf-8 encoding.

shin- avatar Jan 21 '18 00:01 shin-

Be aware, you powershell users, creating a new file usually results in UTF-16+BOM.

Generally speaking, windows 10 does usually create UTF16+BOM files plain as Textfiles. Commandline, API calls.

BananaAcid avatar Oct 12 '18 07:10 BananaAcid

我也有同样的问题,是因为 .dockerignore文件中包含中文 I have the same problem because the. dockerignore file contains Chinese.

swzyt avatar Jun 27 '19 08:06 swzyt

Looks like your .env file isn't encoded properly. Please make sure you're using utf-8 encoding.

What worked for me was creating an empty .env file in the directory I run docker-compose in (encoded as UTF-8).

koell09 avatar Feb 07 '20 10:02 koell09

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 0: invalid continuation byte [13032] Failed to execute script docker-compose Traceback (most recent call last): File "bin/docker-compose", line 6, in File "compose/cli/main.py", line 72, in main File "compose/cli/main.py", line 125, in perform_command File "compose/cli/command.py", line 47, in project_from_options File "compose/config/environment.py", line 77, in from_env_file File "compose/config/environment.py", line 72, in _initialize File "compose/config/environment.py", line 44, in env_vars_from_file File "/code/.tox/py37/lib/python3.7/codecs.py", line 714, in next File "/code/.tox/py37/lib/python3.7/codecs.py", line 645, in next File "/code/.tox/py37/lib/python3.7/codecs.py", line 558, in readline File "/code/.tox/py37/lib/python3.7/codecs.py", line 504, in read UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 0: invalid continuation byte [13036] Failed to execute script docker-compose root@radio:/var/azuracast#

Hi, How do I solve a problem? I don’t know what to do

kamalne avatar Jun 24 '20 07:06 kamalne

when running docker-compose up This error happens:

ERROR: .UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe3 in position 4: invalid continuation byte

Versions : docker-compose version 1.26.2, build unknown Docker version 19.03.12, build 48a6621

On Raspibian

locale

LANG=en_US.UTF-8 LANGUAGE=pt_BR.UTF-8 LC_CTYPE="pt_BR.UTF-8" LC_NUMERIC="pt_BR.UTF-8" LC_TIME="pt_BR.UTF-8" LC_COLLATE="pt_BR.UTF-8" LC_MONETARY="pt_BR.UTF-8" LC_MESSAGES="pt_BR.UTF-8" LC_PAPER="pt_BR.UTF-8" LC_NAME="pt_BR.UTF-8" LC_ADDRESS="pt_BR.UTF-8" LC_TELEPHONE="pt_BR.UTF-8" LC_MEASUREMENT="pt_BR.UTF-8" LC_IDENTIFICATION="pt_BR.UTF-8" LC_ALL=pt_BR.UTF-8

Andrefiel avatar Jul 31 '20 01:07 Andrefiel

I have the same issue :+1: docker-compose ps Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 11, in sys.exit(main()) File "/usr/local/lib/python3.6/dist-packages/compose/cli/main.py", line 67, in main command() File "/usr/local/lib/python3.6/dist-packages/compose/cli/main.py", line 123, in perform_command project = project_from_options('.', options) File "/usr/local/lib/python3.6/dist-packages/compose/cli/command.py", line 69, in project_from_options environment_file=environment_file File "/usr/local/lib/python3.6/dist-packages/compose/cli/command.py", line 132, in get_project verbose=verbose, version=api_version, context=context, environment=environment File "/usr/local/lib/python3.6/dist-packages/compose/cli/docker_client.py", line 43, in get_client environment=environment, tls_version=get_tls_version(environment) File "/usr/local/lib/python3.6/dist-packages/compose/cli/docker_client.py", line 170, in docker_client client = APIClient(**kwargs) File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 132, in init config_dict=self._general_configs, credstore_env=credstore_env, File "/usr/local/lib/python3.6/dist-packages/docker/auth.py", line 361, in load_config return AuthConfig.load_config(config_path, config_dict, credstore_env) File "/usr/local/lib/python3.6/dist-packages/docker/auth.py", line 185, in load_config config_dict.pop('auths'), raise_on_error=True File "/usr/local/lib/python3.6/dist-packages/docker/auth.py", line 141, in parse_auth username, password = decode_auth(entry['auth']) File "/usr/local/lib/python3.6/dist-packages/docker/auth.py", line 336, in decode_auth return login.decode('utf8'), pwd.decode('utf8') UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc5 in position 16: invalid continuation byte

still unable to solve.. any help is welcome

xoroz avatar Jan 15 '21 09:01 xoroz

@xoroz ~~let me guess, your locale is also pt_BR?~~ I know another unrelated context where users with pt_BR locale are having problems: https://github.com/libvips/pyvips/issues/80 although it's on Windows.

int-ua avatar Jan 22 '21 14:01 int-ua

not really it was UTF-8 i had to rebuild the entire server. i tried everything including reinstalling docker and docker-compose nothing helped..

On Fri, Jan 22, 2021 at 3:50 PM Serhiy Zahoriya [email protected] wrote:

@xoroz https://github.com/xoroz let me guess, your locale is also pt_BR? I know another unrelated context where users with pt_BR locale are having problems: libvips/pyvips#80 https://github.com/libvips/pyvips/issues/80

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/docker/compose/issues/5442#issuecomment-765455362, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6I4DV4V2YA77AMSL44HGTS3GGDLANCNFSM4EG7BVBA .

-- Felipe Ferreira

xoroz avatar Jan 22 '21 15:01 xoroz

same issue when run docker-compose(1.28.5) embedded in docker-desktop on win 10: `λ docker-compose up -d Traceback (most recent call last): File "docker\api\client.py", line 214, in _retrieve_server_version File "docker\api\daemon.py", line 181, in version File "docker\utils\decorators.py", line 46, in inner File "docker\api\client.py", line 237, in _get File "requests\sessions.py", line 543, in get File "requests\sessions.py", line 516, in request File "requests\sessions.py", line 446, in prepare_request File "requests\utils.py", line 204, in get_netrc_auth File "netrc.py", line 30, in init File "netrc.py", line 39, in _parse File "shlex.py", line 109, in get_token File "shlex.py", line 140, in read_token UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in position 49: illegal multibyte sequence

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "docker-compose", line 3, in File "compose\cli\main.py", line 80, in main File "compose\cli\main.py", line 189, in perform_command File "compose\cli\command.py", line 60, in project_from_options File "compose\cli\command.py", line 152, in get_project File "compose\cli\docker_client.py", line 41, in get_client File "compose\cli\docker_client.py", line 170, in docker_client File "docker\api\client.py", line 197, in init File "docker\api\client.py", line 221, in _retrieve_server_version docker.errors.DockerException: Error while fetching server API version: 'gbk' codec can't decode byte 0xaa in position 49: illegal multibyte sequence [13504] Failed to execute script docker-compose`

fbird avatar May 06 '21 04:05 fbird

How to solve this problem?

xubo245 avatar Feb 08 '22 03:02 xubo245

docker-compose up -d
Traceback (most recent call last):
  File "/root/buildbox/Python-3.8.2/bin/docker-compose", line 10, in <module>
    sys.exit(main())
  File "/root/buildbox/Python-3.8.2/lib/python3.8/site-packages/compose/cli/main.py", line 81, in main
    command_func()
  File "/root/buildbox/Python-3.8.2/lib/python3.8/site-packages/compose/cli/main.py", line 200, in perform_command
    project = project_from_options('.', options)
  File "/root/buildbox/Python-3.8.2/lib/python3.8/site-packages/compose/cli/command.py", line 60, in project_from_options
    return get_project(
  File "/root/buildbox/Python-3.8.2/lib/python3.8/site-packages/compose/cli/command.py", line 152, in get_project
    client = get_client(
  File "/root/buildbox/Python-3.8.2/lib/python3.8/site-packages/compose/cli/docker_client.py", line 41, in get_client
    client = docker_client(
  File "/root/buildbox/Python-3.8.2/lib/python3.8/site-packages/compose/cli/docker_client.py", line 170, in docker_client
    client = APIClient(use_ssh_client=not use_paramiko_ssh, **kwargs)
  File "/root/buildbox/Python-3.8.2/lib/python3.8/site-packages/docker/api/client.py", line 131, in __init__
    self._auth_configs = auth.load_config(
  File "/root/buildbox/Python-3.8.2/lib/python3.8/site-packages/docker/auth.py", line 359, in load_config
    return AuthConfig.load_config(config_path, config_dict, credstore_env)
  File "/root/buildbox/Python-3.8.2/lib/python3.8/site-packages/docker/auth.py", line 182, in load_config
    'auths': cls.parse_auth(
  File "/root/buildbox/Python-3.8.2/lib/python3.8/site-packages/docker/auth.py", line 139, in parse_auth
    username, password = decode_auth(entry['auth'])
  File "/root/buildbox/Python-3.8.2/lib/python3.8/site-packages/docker/auth.py", line 334, in decode_auth
    return login.decode('utf8'), pwd.decode('utf8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xee in position 1: invalid continuation byte

xubo245 avatar Feb 08 '22 03:02 xubo245

For anyone still facing this issue (I saw some recent comments), please be aware that Compose V1 is EOL, and not being maintained asides from critical security fixes. Please check out Compose V2 (which is GA) (install instructions here).

laurazard avatar Dec 29 '22 17:12 laurazard