compose: `logs` encoding is incorrect
Description of the issue
docker-compose logs
outputs as a Windows-specific encoding while docker logs
properly outputs as utf-8
ofek.lev@OZONE C:\Users\ofek.lev\Desktop\code\integrations-core\riakcs\tests\compose
$ python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> import sys
>>> print(sys.getdefaultencoding())
utf-8
>>> for line in subprocess.run('docker logs 9f3b1d3828a3', stdout=subprocess.PIPE).stdout.splitlines()[:2]: print(line)
...
b"Update data permissions in case it's mounted as volume\xe2\x80\xa6 OK!"
b'Starting Riak\xe2\x80\xa6 OK!'
>>> for line in subprocess.run('docker-compose logs --no-color', stdout=subprocess.PIPE).stdout.splitlines()[:3]: print(line)
...
b'Attaching to dd-test-riakcs'
b"dd-test-riakcs | Update data permissions in case it's mounted as volume\x85 OK!"
b'dd-test-riakcs | Starting Riak\x85 OK!'
>>> for line in subprocess.run('docker-compose logs --no-color', stdout=subprocess.PIPE, encoding='cp1252').stdout.splitlines()[:3]: print(line.encode())
...
b'Attaching to dd-test-riakcs'
b"dd-test-riakcs | Update data permissions in case it's mounted as volume\xe2\x80\xa6 OK!"
b'dd-test-riakcs | Starting Riak\xe2\x80\xa6 OK!'
Context information (for bug reports)
Output of docker-compose version
docker-compose version 1.23.2, build 1110ad01
docker-py version: 3.6.0
CPython version: 3.6.6
OpenSSL version: OpenSSL 1.0.2o 27 Mar 2018
Output of docker version
Client: Docker Engine - Community
Version: 18.09.2
API version: 1.39
Go version: go1.10.8
Git commit: 6247962
Built: Sun Feb 10 04:12:31 2019
OS/Arch: windows/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.2
API version: 1.39 (minimum version 1.12)
Go version: go1.10.6
Git commit: 6247962
Built: Sun Feb 10 04:13:06 2019
OS/Arch: linux/amd64
Experimental: false
Kubernetes:
Version: v1.10.11
StackAPI: v1beta2
Output of docker-compose config
services:
dd-test-riakcs:
container_name: dd-test-riakcs
environment:
RIACK_CS_BUCKET: foo
image: ianbytchek/riak-cs
ports:
- published: 8080
target: 8080
version: '3.5'
Observed result
encoding (after much debugging to render ellipsis
properly) is cp1252
Expected result
encoding should be utf-8
Additional information
Windows 10 pro, docker-compose
installed via pip
cc @shin-
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 10
- Comments: 25
Commits related to this issue
- Support Windows See https://github.com/docker/compose/issues/6527 — committed to DataDog/integrations-core by ofek 5 years ago
- Make e2e work (#3894) * Make e2e work Enable e2e to work by adding start commands in the agent to install the mq client lib. This also late import pymqi so that the env started doesn't require t... — committed to DataDog/integrations-core by therve 5 years ago
+1 still happening on Windows 11 Pro.
+1, docker-compose version 1.29.2, build 5becea4c, on MacOS
It’s still happening on Ubuntu.