Docker异常docker-compose up throw UnicodeDecodeError: 'ascii' codec can't decode byte 0x(代

Posted 756623607-zhang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker异常docker-compose up throw UnicodeDecodeError: 'ascii' codec can't decode byte 0x(代相关的知识,希望对你有一定的参考价值。

 

一、异常

[root@VM_0_4_centos prometheus-grafana-linux]# docker-compose up
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 9, in <module>
    load_entry_point(docker-compose==1.18.0, console_scripts, docker-compose)()
  File "/usr/lib/python3.4/site-packages/compose/cli/main.py", line 71, in main
    command()
  File "/usr/lib/python3.4/site-packages/compose/cli/main.py", line 121, in perform_command
    project = project_from_options(., options)
  File "/usr/lib/python3.4/site-packages/compose/cli/command.py", line 37, in project_from_options
    override_dir=options.get(--project-directory),
  File "/usr/lib/python3.4/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.4/site-packages/compose/config/config.py", line 278, in find
    [ConfigFile.from_filename(f) for f in filenames],
  File "/usr/lib/python3.4/site-packages/compose/config/config.py", line 278, in <listcomp>
    [ConfigFile.from_filename(f) for f in filenames],
  File "/usr/lib/python3.4/site-packages/compose/config/config.py", line 178, in from_filename
    return cls(filename, load_yaml(filename))
  File "/usr/lib/python3.4/site-packages/compose/config/config.py", line 1305, in load_yaml
    return yaml.safe_load(fh)
  File "/usr/lib64/python3.4/site-packages/yaml/__init__.py", line 94, in safe_load
    return load(stream, SafeLoader)
  File "/usr/lib64/python3.4/site-packages/yaml/__init__.py", line 70, in load
    loader = Loader(stream)
  File "/usr/lib64/python3.4/site-packages/yaml/loader.py", line 24, in __init__
    Reader.__init__(self, stream)
  File "/usr/lib64/python3.4/site-packages/yaml/reader.py", line 85, in __init__
    self.determine_encoding()
  File "/usr/lib64/python3.4/site-packages/yaml/reader.py", line 124, in determine_encoding
    self.update_raw()
  File "/usr/lib64/python3.4/site-packages/yaml/reader.py", line 178, in update_raw
    data = self.stream.read(size)
  File "/usr/lib64/python3.4/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: ascii codec cant decode byte 0xe3 in position 97: ordinal not in range(128)

 

二、解决方案

docker-compose.yml文件去除中文符号就可以了

以上是关于Docker异常docker-compose up throw UnicodeDecodeError: 'ascii' codec can't decode byte 0x(代的主要内容,如果未能解决你的问题,请参考以下文章

docker-compose up与docker-compose up -d

使用`docker-compose run`时无法调试,但`docker-compose up`有效

Docker-compose up时报错:

docker-compose up 容器开始排序

保持 Redis 数据在 Docker 容器中的 docker-compose down 和 up 之间保持活跃

Docker-Compose Up 有效,但 Eb Local Run 无效