我已经创建了一个相当标准的asp.net核心应用程序,我在Docker中托管。这是在本地运行的,现在我尝试使用VSTS来构建和部署到Azure。 构建步骤失败,并显示以下消息:
Service 'coredockerapi' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder145772260/obj/Docker/publish: no such file or directory
以下是VSTS的完整日志输出:
2017-11-18T11:52:07.4647720Z ##[section]Starting: Build Repo and create container
2017-11-18T11:52:07.5468610Z ==============================================================================
2017-11-18T11:52:07.5514890Z Task : Docker Compose
2017-11-18T11:52:07.5550720Z Description : Build, push or run multi-container Docker applications. Task can be used with Docker or Azure Container registry.
2017-11-18T11:52:07.5606920Z Version : 0.4.7
2017-11-18T11:52:07.5628440Z Author : Microsoft Corporation
2017-11-18T11:52:07.5655390Z Help : [More Information](https://go.microsoft.com/fwlink/?linkid=848006)
2017-11-18T11:52:07.5678480Z ==============================================================================
2017-11-18T11:52:09.5543380Z 50f571c1-89b9-4b2f-8ea8-097b0966e534 exists true
2017-11-18T11:52:10.4809920Z [command]/usr/local/bin/docker-compose -f /opt/vsts/work/1/s/DemoCoreDocker/docker-compose.yml -p DemoDocker run --rm -T coredockerapi
2017-11-18T11:52:10.8401740Z Creating network "demodocker_default" with the default driver
2017-11-18T11:52:10.9847570Z Building coredockerapi
2017-11-18T11:52:11.0663980Z Step 1/6 : FROM microsoft/aspnetcore:2.0
2017-11-18T11:52:12.3621450Z 2.0: Pulling from microsoft/aspnetcore
2017-11-18T11:52:27.7530280Z Digest: sha256:b5e62c20e77b287b014fc0182f0e21dc1bba7aa0a42ac40338e303fdb5b49638
2017-11-18T11:52:27.7774720Z Status: Downloaded newer image for microsoft/aspnetcore:2.0
2017-11-18T11:52:27.7814270Z ---> 757f574feed9
2017-11-18T11:52:27.7883450Z Step 2/6 : ARG source
2017-11-18T11:52:27.8732530Z ---> Running in bc9b4aa5e33b
2017-11-18T11:52:28.0333270Z ---> 612c57db7df1
2017-11-18T11:52:28.0598310Z Removing intermediate container bc9b4aa5e33b
2017-11-18T11:52:28.0636200Z Step 3/6 : WORKDIR /app
2017-11-18T11:52:28.3684690Z ---> fc4ab62cecd6
2017-11-18T11:52:28.3904360Z Removing intermediate container baedca1c9c5d
2017-11-18T11:52:28.3935980Z Step 4/6 : EXPOSE 80
2017-11-18T11:52:28.5164070Z ---> Running in c8bbbf929c3a
2017-11-18T11:52:28.6861730Z ---> 578c84507512
2017-11-18T11:52:28.7087730Z Removing intermediate container c8bbbf929c3a
2017-11-18T11:52:28.7172780Z Step 5/6 : COPY ${source:-obj/Docker/publish} .
2017-11-18T11:52:28.7256500Z Service 'coredockerapi' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder145772260/obj/Docker/publish: no such file or directory
2017-11-18T11:52:28.7798470Z ##[error]Creating network "demodocker_default" with the default driver
2017-11-18T11:52:28.7901050Z ##[error]Building coredockerapi
2017-11-18T11:52:28.8022370Z ##[error]Service 'coredockerapi' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder145772260/obj/Docker/publish: no such file or directory
2017-11-18T11:52:28.8334530Z [command]/usr/local/bin/docker-compose -f /opt/vsts/work/1/s/DemoCoreDocker/docker-compose.yml -p DemoDocker down
2017-11-18T11:52:29.2414990Z Removing network demodocker_default
2017-11-18T11:52:29.4374050Z ##[error]/usr/local/bin/docker-compose failed with return code: 1
2017-11-18T11:52:29.5268820Z ##[section]Finishing: Build Repo and create container
这是我的docker-compose.yml
version: '3'
services:
coredockerapi:
image: coredockerapi
build:
context: ./CoreDockerAPI
dockerfile: Dockerfile
谢谢。
答案 0 :(得分:4)
如果有人在运行compose build或up时仍有问题 - 错误消息:
服务'php'无法构建:COPY失败:stat / var / lib / docker / tmp / docker-builder ...
我身边的问题应该在 .dockerignore ,其中引用了要复制的文件夹。只需删除需要复制的文件夹行。
答案 1 :(得分:0)
请参阅以下步骤将项目部署到Azure:
**/docker-compose.ci.build.yml
;操作:Run a Docker Compose command
;命令:run ci-build
)$(System.DefaultWorkingDirectory)/[your project path]/obj/Docker/publish
;内容:**
;目标文件夹:$(Build.ArtifactStagingDirectory)
)$(Build.ArtifactStagingDirectory)
)$(System.DefaultWorkingDirectory)/[artifact build definition name]/[artifact name]
;取消选中Publish using Web Deploy option
)另一方面,有一个可能对您有益的相关主题:Docker compose VSTS task failder