Team City Linux代理Docker构建失败(Docker中的Docker) - 创建aufs mount到/var/lib/docker/aufs/mnt/...-init时出错:参数无效

时间:2017-12-17 09:56:30

标签: docker teamcity

我正在尝试在docker中设置TeamCity Linux Agent。代理需要能够构建dotnet core 2应用程序,然后在应用程序上构建docker。

我在Windows 10 atm下运行Docker,但计划是该容器将在AWS中的Linux下运行。

我已经启动并运行了TC Agent容器,dotnet的东西已经整理好了但是我停留在了docker的东西上。

以下是TC代理日志:

[08:33:47]Step 2/2: Docker Build (2m:16s)
[08:33:48][Step 2/2] Starting: docker build --pull -f Dockerfile .
[08:33:48][Step 2/2] in directory: /opt/buildagent/work/274731defed46d9f/think.ETL
[08:33:48][Step 2/2] 
[08:33:48][Step 2/2] Step 1/9 : FROM microsoft/aspnetcore:2.0.4
[08:33:51][Step 2/2] 2.0.4: Pulling from microsoft/aspnetcore
[08:33:52][Step 2/2] 723254a2c089: Pulling fs layer
[08:33:52][Step 2/2] 499be8ca2075: Pulling fs layer
[08:33:52][Step 2/2] a6854c900e79: Pulling fs layer
[08:33:52][Step 2/2] 36653ffe7e35: Pulling fs layer
[08:33:52][Step 2/2] 2c2c279d1b1a: Pulling fs layer
[08:33:52][Step 2/2] 36653ffe7e35: Waiting
[08:33:52][Step 2/2] 2c2c279d1b1a: Waiting
[08:33:54][Step 2/2] a6854c900e79: Download complete
[08:35:02][Step 2/2] 36653ffe7e35: Verifying Checksum
[08:35:02][Step 2/2] 36653ffe7e35: Download complete
[08:35:30][Step 2/2] 499be8ca2075: Verifying Checksum
[08:35:30][Step 2/2] 499be8ca2075: Download complete
[08:35:41][Step 2/2] 2c2c279d1b1a: Verifying Checksum
[08:35:41][Step 2/2] 2c2c279d1b1a: Download complete
[08:35:54][Step 2/2] 723254a2c089: Verifying Checksum
[08:35:54][Step 2/2] 723254a2c089: Download complete
[08:35:58][Step 2/2] 723254a2c089: Pull complete
[08:35:59][Step 2/2] 499be8ca2075: Pull complete
[08:36:00][Step 2/2] a6854c900e79: Pull complete
[08:36:01][Step 2/2] 36653ffe7e35: Pull complete
[08:36:04][Step 2/2] 2c2c279d1b1a: Pull complete
[08:36:04][Step 2/2] Digest: sha256:0a54eac597bdb205f3023410741d7492dcb52cf9a5b1f917755dc755339e4002
[08:36:04][Step 2/2] Status: Downloaded newer image for microsoft/aspnetcore:2.0.4
[08:36:04][Step 2/2]  ---> e49b04bf00d5
[08:36:04][Step 2/2] Step 2/9 : ARG source
[08:36:04][Step 2/2] error creating aufs mount to /var/lib/docker/aufs/mnt/ccc81e8c41476a5f72ea23ffc7222ba9b65c47b032a389db9acec26730d1a114-init: invalid argument
[08:36:04][Step 2/2] error creating aufs mount to /var/lib/docker/aufs/mnt/ccc81e8c41476a5f72ea23ffc7222ba9b65c47b032a389db9acec26730d1a114-init: invalid argument
[08:36:04][Step 2/2] Process exited with code 1
[08:36:04][Step 2/2] Process exited with code 1
[08:36:04][Step 2/2] Step Docker Build failed

这些是我达到目标的指示

- 安装TC代理 - https://hub.docker.com/r/jetbrains/teamcity-agent/

  • docker run -it --name teamcity-agent-linux -e SERVER_URL =" http://192.168.50.217:8111" -v D:\ TeamCity \ Agent \ conf:/ data / teamcity_agent / conf --privileged -e DOCKER_IN_DOCKER =" start" JetBrains的/ TeamCity的剂

- 安装.Net Core 2x - https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x

- 修复VS2017 Docker-Compose项目中断构建命令行 - https://github.com/dotnet/cli/issues/6178

  • mkdir /usr/share/dotnet/sdk/2.0.0/Sdks/Microsoft.Docker.Sdk
  • 将C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 {SKU} \ MSBuild \ Sdks \ Microsoft.Docker.Sdk \ Sdk复制到D:\ TeamCity \ Agent \ conf(/ usr / share / dotnet / SDK / 2.0.0 / SDKS)
  • cp -a /data/teamcity_agent/conf/Microsoft.Docker.Sdk/ /usr/share/dotnet/sdk/2.0.0/Sdks /
  • sudo apt install nuget

我已阅读并关注(未成功)Error: "error creating aufs mount to" when building dockerfile

所以任何想法如何解决错误"错误创建aufs挂载到/ var / lib / docker / aufs / mnt / ccc81e8c41476a5f72ea23ffc7222ba9b65c47b032a389db9acec26730d1a114-init:无效参数"

1 个答案:

答案 0 :(得分:1)

看起来/var/lib/docker应该在Windows上安装在外部,而TeamCity构建代理不会将其声明为开箱即用。

解决方案是在Windows上启动jetbrains / teamcity-agent时传递-v docker_volumes:/var/lib/docker之类的参数