docker container 设置编码为utf8

    xiaoxiao2021-04-18  198

    以Ubuntu 14.04 为例创建编码为utf8的container1、创建dockerfile文件

    FROM ubuntu:14.04 RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \ && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 ENV LANG en_US.utf8

    2、根据dockerfile创建container

    docker build -f dockerfile -t ubuntu-utf8:14.04 .

    3、查看images

    docker images

    显示结果

    REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu-utf8 14.04 103380db15a9 About an hour ago 190MB

    4、生成container

    docker run -it 103380db15a9 '/bin/bash'

    5、查看locale

    root@f8d0b253a9f2:/# locale LANG=en_US.utf8 LANGUAGE= LC_CTYPE="en_US.utf8" LC_NUMERIC="en_US.utf8" LC_TIME="en_US.utf8" LC_COLLATE="en_US.utf8" LC_MONETARY="en_US.utf8" LC_MESSAGES="en_US.utf8" LC_PAPER="en_US.utf8" LC_NAME="en_US.utf8" LC_ADDRESS="en_US.utf8" LC_TELEPHONE="en_US.utf8" LC_MEASUREMENT="en_US.utf8" LC_IDENTIFICATION="en_US.utf8" LC_ALL=

    最新回复(0)