Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

COPY failed: stat /var/lib/docker/tmp/docker-builder700869788/private: no such file or directory [closed]

Tags:

linux

docker

ssh

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?

like image 410
user9287271 Avatar asked Feb 06 '18 02:02

user9287271


2 Answers

You should put the file into the same directory with Dockerfile.

like image 170
SmallChess Avatar answered Nov 20 '22 13:11

SmallChess


Did you try to run docker build from outside the Dockerfile directory? It worked for me: docker build dir/.

like image 1
HEBERTSON MENEZES Avatar answered Nov 20 '22 11:11

HEBERTSON MENEZES