1

I produced this PoC (proof of concept) code to show a problam I am dealing with.

Project structure:

# ls -R docker_codes/
docker_codes/:
docker-compose.yml  dockerfile

dockerfile:

FROM ubuntu
RUN apt-get update
RUN apt-get install -y python3
RUN export export LC_ALL="en_US.UTF-8"
RUN python3 -c "print (u'voil\u00e0')"

docker.compose.yml

version: '3.5'
services:
  app01:
    build: 
      context: . 

Command: docker-compose up

Output Error:

Traceback (most recent call last):
  File "/bin/docker-compose", line 11, in <module>
    load_entry_point('docker-compose==1.18.0', 'console_scripts', 'docker-compose')()
  File "/usr/lib/python3.6/site-packages/compose/cli/main.py", line 71, in main
    command()
  File "/usr/lib/python3.6/site-packages/compose/cli/main.py", line 124, in perform_command
    handler(command, command_options)
  File "/usr/lib/python3.6/site-packages/compose/cli/main.py", line 959, in up
    start=not no_start
  File "/usr/lib/python3.6/site-packages/compose/project.py", line 452, in up
    svc.ensure_image_exists(do_build=do_build)
  File "/usr/lib/python3.6/site-packages/compose/service.py", line 324, in ensure_image_exists
    self.build()
  File "/usr/lib/python3.6/site-packages/compose/service.py", line 972, in build
    all_events = stream_output(build_output, sys.stdout)
  File "/usr/lib/python3.6/site-packages/compose/progress_stream.py", line 23, in stream_output
    print_output_event(event, stream, is_terminal)
  File "/usr/lib/python3.6/site-packages/compose/progress_stream.py", line 90, in print_output_event
    stream.write("%s%s" % (event['stream'], terminator))
UnicodeEncodeError: 'ascii' codec can't encode character '\xe0' in position 4: ordinal not in range(128)

The line "RUN export export LC_ALL="en_US.UTF-8"" is the work around to deal with this problem but no sucess.

SOLUTION:

1
  • did you tried it with docker run command instead of compose docker run -it --rm your_image _name? Commented Jun 27, 2020 at 1:01

1 Answer 1

2

RUN export LC_ALL=es_US.UTF-8 will not be persisted in the following layer. Use native docker syntax for environment variables: ENV LC_ALL=es_US.UTF-8

And install locales-all pakage for getting internationalization support

Sign up to request clarification or add additional context in comments.

1 Comment

The Debian wiki discourages setting LC_ALL except when testing, and suggests setting LANG is the usual approach.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.