I got an error:
COPY failed: stat /var/lib/docker/tmp/docker-builder700869788/private: no such file or directory .
I wrote in Dockerfile:
FROM "centos"
RUN mkdir ~/.ssh
COPY ./private ~/.ssh/id_rsa
RUN yum install -y https://centos7.iuscommunity.org/ius-release.rpm
RUN yum install -y wget
RUN yum update -y
and when I run docker build ./ -t docker/app
,I got an error:
Status: Downloaded newer image for centos:latest
---> ff426288ea90
Step 2/22 : RUN mkdir ~/.ssh
---> Running in 49d3950mwpion
Removing intermediate container 49d73360f899
---> 24shentufhckm
Step 3/22 : COPY ./private ~/.ssh/id_rsa
COPY failed: stat /var/lib/docker/tmp/docker-builder700869788/private: no such file or directory .
Of course, private key is in my PC.Now this Dockerfile is in myname/Desktop/app/Dockerfile .And private ket is in ~/.ssh/id_rsa .Is this error meaning directory wrong?
You should put the file into the same directory with Dockerfile.
Did you try to run docker build
from outside the Dockerfile directory? It worked for me: docker build dir/
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With