compose icon indicating copy to clipboard operation
compose copied to clipboard

`logs` encoding is incorrect

Open ofek opened this issue 6 years ago • 20 comments

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-

ofek avatar Feb 19 '19 22:02 ofek

@shin- Do you why this may be happening, or of any workarounds for now?

ofek avatar Feb 27 '19 17:02 ofek

Any update on this?

ofek avatar Jun 07 '19 16:06 ofek

I have the same issue with "docker-compose logs" when running docker-compose as a container

andrewmed avatar Jun 15 '19 16:06 andrewmed

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 12 '19 16:12 stale[bot]

Still an issue

ofek avatar Dec 12 '19 17:12 ofek

This issue has been automatically marked as not stale anymore due to the recent activity.

stale[bot] avatar Dec 12 '19 17:12 stale[bot]

Still an issue on compose v1.25.2

0h41 avatar Jan 23 '20 08:01 0h41

I'm also experiencing this - compose v1.25.4 on OSX

Billy- avatar Feb 22 '20 13:02 Billy-

+1

robermorales avatar May 04 '20 15:05 robermorales

+1, docker-compose version 1.25.5 on Ubuntu

RasmusSoot avatar Jun 20 '20 14:06 RasmusSoot

+1, docker-compose version 1.26.2 on MacOS

johnjcamilleri avatar Sep 03 '20 08:09 johnjcamilleri

+1 docker-compose version 1.26.2 on CentOS 7

domr avatar Sep 29 '20 11:09 domr

+1 docker-compose version 1.27.4, build 40524192 on Ubuntu 20.04 / WSL2 Also, it was nice to realize (amounts of debugging) the trouble was not in my docker images but in docker-compose log output.

lsipii avatar Dec 01 '20 12:12 lsipii

2021, still valid.

nocive avatar Apr 08 '21 12:04 nocive

It's still happening on Ubuntu.

k-inoway avatar Jul 15 '21 04:07 k-inoway

+1, docker-compose version 1.29.2, build 5becea4c, on MacOS

oguseynov avatar Aug 22 '21 14:08 oguseynov

+1 Nov 2021, still happening on Windows 10. docker-compose version v2.1.1.

ricshz avatar Nov 11 '21 00:11 ricshz

+1 still happening on Windows 11 Pro.

ZsgsDesign avatar Jan 07 '22 00:01 ZsgsDesign

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 10 '22 12:07 stale[bot]

This issue has been automatically closed because it had not recent activity during the stale period.

stale[bot] avatar Aug 01 '22 00:08 stale[bot]

This issue has been automatically closed because it had not recent activity during the stale period.

stale[bot] avatar Aug 13 '22 11:08 stale[bot]

Please reopen this issue as this is still happening on Windows 11 with Ubuntu (store version, 2204.1.6.0) on WSL 0.66.2.0

istvan-ujjmeszaros avatar Sep 14 '22 01:09 istvan-ujjmeszaros

Still experiencing it on:

Linux 5.15.81-1-MANJARO #1 SMP PREEMPT Fri Dec 2 21:02:26 UTC 2022 x86_64 GNU/Linux

kamichal avatar Dec 12 '22 09:12 kamichal

Still happening +1

sterling000 avatar Jan 07 '23 03:01 sterling000

+1, Still occurring

giajones avatar Feb 17 '23 18:02 giajones