如何在mac上运行的TeamCity代理上设置区域设置?

时间:2017-07-24 12:06:06

标签: console teamcity

我在Mac上运行了一个TeamCity代理。服务器位于docker中,并且是它们设置的当前版本。

当我pod install时,我收到以下错误

[11:50:13][Step 2/3]     WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
[11:50:13][Step 2/3]     Consider adding the following to ~/.profile:
[11:50:13][Step 2/3] 
[11:50:13][Step 2/3]     export LANG=en_US.UTF-8

如果我在构建步骤中运行locale,我会看到

[11:50:11][Step 2/3] LANG=
[11:50:11][Step 2/3] LC_COLLATE="C"
[11:50:11][Step 2/3] LC_CTYPE="C"
[11:50:11][Step 2/3] LC_MESSAGES="C"
[11:50:11][Step 2/3] LC_MONETARY="C"
[11:50:11][Step 2/3] LC_NUMERIC="C"
[11:50:11][Step 2/3] LC_TIME="C"
[11:50:11][Step 2/3] LC_ALL=

如果我在普通bash控制台中以代理用户身份登录时也这样做,我会看到

LANG="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_CTYPE="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_ALL=

如何在TeamCity代理运行的控制台中设置LANG etc属性?

1 个答案:

答案 0 :(得分:0)

所以这是Docker绑定服务器。

我创建了一个泊坞文件Dockerfile-server

FROM 'jetbrains/teamcity-server'

RUN apt-get update && apt-get install locales -y  
RUN locale-gen en_GB.UTF-8  
ENV LANG en_GB.UTF-8  
ENV LANGUAGE en_GB:en  
ENV LC_ALL en_GB.UTF-8 

并在我的docker-compose.yml文件中引用它

version: '3'

services:  
  server:
    build:
      context: .
      dockerfile: Dockerfile-server
    volumes:
    - '/Users/teamcity/Desktop/data:/data/teamcity_server/datadir'
    - '/Users/teamcity/Desktop/logs:/data/teamcity/logs'
    ports:
      - 8111:8111
    environment:
      - TEAMCITY_SERVER_MEM_OPTS="-Xmx750m"

我看到了结果

[13:25:26][Step 2/3] LANG="en_GB.UTF-8"
[13:25:26][Step 2/3] LC_COLLATE="en_GB.UTF-8"
[13:25:26][Step 2/3] LC_CTYPE="en_GB.UTF-8"
[13:25:26][Step 2/3] LC_MESSAGES="en_GB.UTF-8"
[13:25:26][Step 2/3] LC_MONETARY="en_GB.UTF-8"
[13:25:26][Step 2/3] LC_NUMERIC="en_GB.UTF-8"
[13:25:26][Step 2/3] LC_TIME="en_GB.UTF-8"
[13:25:26][Step 2/3] LC_ALL=

外观极好