1

I use azure devops pipeline to build jar and put it to docker image.
I use maven to build jar and put jar and dependencies to folder /componentA/target/container
Pom file - /componemtA/pom.xml
Docker file - /componentA/docker/Dockerfile

My pipeline yuml file is

...... stages: - stage: BUILD jobs: - job: BUILD_JAR_AND_IMAGE steps: - task: MavenAuthenticate@0 .... - task: Maven@3 ...... - task: Docker@2 inputs: command: login containerRegistry: xxxx - task: Docker@2 displayName: Build an image inputs: containerRegistry: 'xxx' repository: '$(image_name)' command: 'build' Dockerfile: '$(component_dir)/docker/Dockerfile' tags: '$(Build.BuildNumber)' 

My docker file is:

..... COPY /componentA/target/container /opt .... 

And I get error
2021-01-12T00:04:43.9376526Z Step 2/19 : COPY /componentA/target/container /opt
2021-01-12T00:04:43.9431565Z COPY failed: stat /var/lib/docker/tmp/docker-builder630817503/componentA/target/container: no such file or directory
2021-01-12T00:04:43.9501516Z ##[error]COPY failed: stat /var/lib/docker/tmp/docker-builder630817503/besReportService/target/container: no such file or directory
2021-01-12T00:04:43.9717162Z ##[error]The process '/usr/bin/docker' failed with exit code 1

copy command starts in var/lib/docker/tmp/docker-builder630817503 instead of /home/vsts/work/1/s

How to fix this problem ?

0

1 Answer 1

0

Check whether you have .dockerignore file that ignored the directory you was trying to COPY.

Check the following issue to see whether it helps you:

https://github.com/docker/for-linux/issues/90

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.