I have a third party software which was created for arm64. I need to copy them into my arm64 container.
So in my dockerfile, I have:
COPY test.tgz /home/torizon/
But I always got error like this:
[test1 build 2/9] COPY test.tgz /home/torizon/:
failed to solve: failed to compute cache key: failed to calculate checksum of ref a1383e63-2f2b-4499-af80-b0aca55e6ea9::8xobn9hmnjnton1lfdi3txzfj: “/test.tgz”: not found
I have tried different file paths, and even create a directory for appconfig_0 as mentioned in another post, but not working. what is the correct way to bring files into a container in dockerfile (except using docker command).
For some reason it’s complaining that it can’t find this file of yours. Could you describe the folder/directory structure of your setup here? Most importantly where this “test.tgz” file is located relative to your Dockerfile. I can only recreate this error if I try to use COPY on a file that doesn’t exist or use the wrong file path.
Sorry, the error was my fault. I restarted the whole project, the image was built without error.
But I expect the test.tgz should be in container’s /home/torizon/, but after I docker run the image, I didnot see the test.tgz. I will try it again later.
But I expect the test.tgz should be in container’s /home/torizon/, but after I docker run the image, I didnot see the test.tgz. I will try it again later.
How exactly did you verify this? When I use COPY I can see my files where I copied them to in the container.
This test.tgz was the third party programs, with has include files, lib files, and Makefile. I was thinking to integrate these programs with my Qt project in Visual Studio with Torizon. But problem is how to set up linking libraries. I am thinking I need to modify the target_link_libraries in Cmakelists.txt. But I still don’t know how to deal with the link options like “-pthread” in LDFLAGS.
Is this the correct way to check the COPY command in dockerfile?
I mean yes, the COPY command is pretty simple. You can create a simple Dockerfile yourself and test the COPY command to see.
Which Dockerfile did you add this to? Our VSCode projects have multiple Dockerfiles for different situations, maybe you added it to the wrong one. Is this container you’re running suppose to be the debug or release version?
This test.tgz was the third party programs, with has include files, lib files, and Makefile. I was thinking to integrate these programs with my Qt project in Visual Studio with Torizon. But problem is how to set up linking libraries. I am thinking I need to modify the target_link_libraries in Cmakelists.txt. But I still don’t know how to deal with the link options like “-pthread” in LDFLAGS.
What is the correct way to do these?
Assuming these files behave as normal libraries you would add them like any other library. Just modify your CMake file to take into account the new files, and build/link them as needed. There are many examples and references online for CMake. This project uses CMake so it doesn’t really make sense to have a Makefile as well so you’ll probably want to integrate the Makefile stuff into CMake. I guess you could use both, but having 2 different build methods in the same project may be a bit confusing.
Thanks Jeremias.
It just came to my mind that maybe our network blocked the test.tgz. I previous used COPY in dockerfile in another job, it was fine. I will test it again in my home this weekend. The dockerfile I used is the one in my Visual Studio project directory.
For third party program. I will put include files and lib files in the same location that torizon stores them (e.g /usr/lib in container). I will have amd64 and arm64 two versions so that I can cross compile in Visual studio. Hopefully this works.
It just came to my mind that maybe our network blocked the test.tgz. I previous used COPY in dockerfile in another job, it was fine. I will test it again in my home this weekend.
Huh, I’m not sure I understand how your network would be blocking the COPY command in the Dockerfile since it’s a local operation. If this does fix your situation please do let me know, as it would be helpful to understand for future issues similar to this.