我想在docker中设置TeamCity Linux Agent . 代理需要能够构建dotnet core 2应用程序,然后在应用程序上构建docker .
我在Windows 10 atm下运行Docker,但计划是容器将在AWS中的Linux下运行 .
我已经启动并运行了TC代理容器,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
这些是我的指示,以达到我的目标
-- Install TC Agent - 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-agent
-- Install .Net Core 2x - https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x
-
卷曲https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor> microsoft.gpg
-
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
-
sudo sh -c'echo“deb [arch = amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main”> /etc/apt/sources.list.d/dotnetdev.list'
-
sudo apt-get update
-
sudo apt-get install dotnet-sdk-2.0.0
-- Fix for VS2017 Docker-Compose Project breaks build on command line - 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 \ 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
所以任何想法我如何解决错误 "error creating aufs mount to /var/lib/docker/aufs/mnt/ccc81e8c41476a5f72ea23ffc7222ba9b65c47b032a389db9acec26730d1a114-init: invalid argument"
1 回答
看起来像
/var/lib/docker
应该在Windows上外部安装,并且TeamCity构建代理不会将其声明为开箱即用 .解决方案是在Windows上启动jetbrains / teamcity-agent时传递像
-v docker_volumes:/var/lib/docker
这样的参数