-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Python 2.7 inside Docker cannot print unicode without --tty #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You can run a container with docker run -dt --name python python:2 python -c 'print (u"\xc1")'
a191fc9b251aa25e078d3537b6bd4a3e1928d39a0cb0104c4a661a9da067e242
$ docker logs python
Á |
@yosifkit it wasn't working for me. Anyway, I found the real fix. It is to set:
It might be a good idea to add this to the 2.7 Docker file, but at least anyone can add it to their own Dockerfile. Hopefully this ticket can be found by Google. |
Given that we explicitly set |
👍 i always run into that problem and need to google around what environment varible i should add to fix it. |
Finally made a PR: #278 |
I'm trying to run a simple Python app in Docker, using the official
python:2.7
image.My problem is that unless I enable
-t
/--tty
indocker run
, the pythonprint
command terminates when trying to print Unicode characters:If I enable
--tty
it works without errors.The problem is that I want to run this process in the background, using
--detach
and that mode does not support--tty
.What kind of changes do I need to make to my Dockerfile so that it doesn't terminate when trying to print Unicode strings?
Minimal Dockerfile:
Minimal broken run command:
Note: it also works without problems in the official
python:3.5
image.The text was updated successfully, but these errors were encountered: