2016-09-29 18 views
42

umieścić ustawienie locale Kody poniżej do mojego dockerfile,doker ubuntu/bin/sh: 1: locale-gen: Nie znaleziono

FROM node:4-onbuild 

# Set the locale 
RUN locale-gen en_US.UTF-8 
ENV LANG en_US.UTF-8 
ENV LANGUAGE en_US:en 
ENV LC_ALL en_US.UTF-8 

ale daje mi błąd

/bin/sh: 1: locale-gen: not found 
The command '/bin/sh -c locale-gen en_US.UTF-8' returned a non-zero code: 127 

dowolny pomysł?

+7

Może musisz zainstalować 'locales' używając' sudo apt-get -y install locales'? – edwinksl

Odpowiedz

76

Dziękujemy za your comment, edwinksl. Zaktualizowałem mój plik docker, poniżej którego rozwiązałem błąd locale-gen:

FROM node:4-onbuild 

# Set the locale 
RUN apt-get clean && apt-get update && apt-get install -y locales 
RUN locale-gen en_US.UTF-8 
+16

Aby zwiększyć wydajność, należy unikać wielu instrukcji 'RUN', szczególnie gdy są ze sobą ściśle powiązane. Coś w stylu 'RUN apt-get clean && apt-get -y update && apt-get install -y locales && locale-gen en_US.UTF-8' tworzy pojedynczą warstwę zamiast trzech. – tripleee

+1

Może 'update-locale LC_ALL = en_US.UTF-8 LANG = en_US.UTF-8' jest również przydatne https://askubuntu.com/a/505424/196423 – koppor

Powiązane problemy