-
Notifications
You must be signed in to change notification settings - Fork 18.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
COPY failed: stat /var/lib/docker/tmp/docker-builder918577595/... #34986
Comments
Does the file |
I'm running into this too. I have all of the files I want to copy in I have a
It looks like Docker is creating a new |
I have seemed to reach the conclusion that this error happens not only when the source file is missing but also when the permissions on the destination path will not allow access. Does this match your experience?
|
I am currently performing all actions as
In case I didn't list before:
|
I would be very cautious using any directory inside Can you provide the minimal steps to reproduce, not depending on your environment or custom (private) images, e.g. mkdir foo && cd foo
echo '{"hello":"world"}' > config.json
docker build -t testing . -f -<<EOF
FROM alpine
COPY ./config.json /.berkshelf/config.json
EOF |
Same problem. The funniest moment - everything was fine few iterations before. Looks like it got broken after I don't know how to reproduce it, to be frankly. It's broken now and I cannot find a solution to get it back to work at all.
|
Does MyAgSourceAPI/conf/php/testsql.php exists in you current dir?
|
This happened to me when trying to run the docker file from a different directory. I had the Running But running
It found it strange at first because when i had the |
Running |
I have similar issue on Windows.
it did not help to use -f option. I tried same directory as the Dockerfile both by giving relative path as well as qualified path to the docker file as -f D:\path\to\docker\file\Dockerfile |
Following working for me perfectly.
|
I had the same problem on CentOS 7. It seems it's related to either filename or filename length. I had the problem with the filename: node-v6.11.0-linux-x64.tar.xz It was the same file, I just renamed it. This might help find the bug. |
Check .dockerignore You probably trying to copy files that are in .dockerignore. |
I have the same problem in linux but it worked for me specifying COPY ./filename /usr/local.... |
COPY only able copy it's subfolder . |
My mistake was thinking if I explicitly copy a single file, .dockerignore would not be used to filter that instruction. Not so. You cannot COPY a single file in a directory of a million files that you otherwise want to ignore. .dockerignore applies to every COPY command. |
thanks to pointing out the context issue @AshtonHylton-awin and @thaJeztah -- that was the answer for me. For those of you using
|
Always check .dockerignore. I got a project from a third party and it included '*'. No wonder i couldn't copy anything from the context. Thanks @comm1x for pointing it out. |
Reading through this issue, I don't think there's a bug at hand here, so I'll go ahead and close. If you do think there's still a bug after reading through this issue, please open a new ticket with the exact steps to reproduce. |
@frostyandy2k 's answer solved the problem |
That solved my problem! I had the docker folder within .dockerignore but some files within this folder should be copied to the final image. Thank you for this advice! |
I have the same question and I try to issue serval ways but it stlls exists |
I noticed this: |
|
Thanks comm1x! That solved my problem! |
In my case it was a missing coma from the COPY instruction:
Adding a comma after
|
I Manged to go around this by exclusing the folder directive since i was only trying to copy a folder within the working directory i was able to use ( . ) and the url path i.e |
I'm just trying |
my net is slowly so I want to copy my local composer to php container. COPY failed: Forbidden path outside the build context: ../../../script/composer So it is build context probile? |
Thank you for this comment. I've been struggling for 3 hours, and this made me think, just maybe... |
If it can be of help, in my case it was trying to execute a COPY operation as if the context was Dockerfile, but context needed to be docker-compose one level up:
if I were building just from Dockerfile I would have:
but when building from docker-compose which sets the build context as '.' and the dockerfile as src/Dockerfile
|
when i build my docker file i get this error althoughh target folder is there in my project |
@ahmedbokhari7 if you set the in your case, context should probably be set to |
In my case it was a typo in the filename |
I had this problem but I solved it based on the comments of @thaJeztah. Please note that the path starts from where you start the build and not from where your Dockerfile is located. So you need to bear that in mind when writing the path in your Dockerfile and use COPY or ADD. |
I was trying to create docker image using "docker build -t reimage17 ." command. I am getting an error as below while copying the "oracle-instantclient19.6-basic-19.6.0.0.0-1.x86_64.rpm" file from basicinstaclient folder to basic folder. I am executing build command from folder where docker file exist in my windows machine. below is my docker file. FROM ibmcom/websphere-liberty:latest ADD ./rtcc.ear /opt/ibm/wlp/usr/servers/defaultServer/apps RUN mkdir -pv /basic EXPOSE 9088 |
For me, it was happening due to wrong path of local file.. and it took 30 minutes to realize .. lol |
I'm locking the conversation on this thread, as it looks like it's only collecting "this happened to me too" comments; #34986 (comment)
Since that this issue was reported, some improvements have been made in the error messages to make them less confusing (shipped as part of docker 20.10.x)
In Docker 20.10, errors for missing (or excluded) files look like;
And there's a tracking issue to improve output to distinguish "non-existing" files from "files that are excluded by |
Description
I have a Dockerfile that has the line:
COPY MyAgSourceAPI/conf/php/testsql.php /var/www/
But it causes the error:
COPY failed: stat /var/lib/docker/tmp/docker-builder918577595/MyAgSourceAPI/conf/php/testsql.php: no such file or directory
Steps to reproduce the issue:
Describe the results you received:
COPY failed: stat /var/lib/docker/tmp/docker-builder918577595/MyAgSourceAPI/conf/php/testsql.php: no such file or directory
Describe the results you expected:
I would expect the file to be copied.
Additional information you deem important (e.g. issue happens only occasionally):
I have two lines previous to this one:
COPY MyAgsourceAPI/conf/apache/conf.d/myagsource.conf /etc/apache2/conf.d/myagsource.conf
COPY MyAgsourceAPI/conf/apache/sites-available/default.conf /etc/apache2/sites-available/default.conf
They copy a single file and both runs without error.
This seems similiar to issues raised on for-mac and for-linux repositories but the solution (correct .dockerignore) does not seem applicable since this file does not exist.
Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
The text was updated successfully, but these errors were encountered: