No downloaded file

Hi! I’ve written small code in Java which has a given URL and downloading its content to the disc.

I do have Dockerfile:

FROM java:7
COPY . /usr
WORKDIR /usr
RUN javac Main.java
CMD [“java”, “Main”]

and my code in Main.java which works perfectly on my pc. I’ve added a lince of code which should tell me what the path of my downloaded file is. Of course it says - /usr/pic.png
But there is nothing like that in there. Any ideas?

I’m building a new image: docker build -t app
then i run it: docker run -it --rm --name final app

Everything works, but there is no my file, and its not hidden.

Did you go inside the container and looked for that file. You may run without --rm and then do docker exec -it <container-name> /bin/bash and then go to /usr and check. If you think your script worked, it should be available there.

Thank you for the reply!

You were right, almost all files were in /usr in my container except pic.png All i mean - for example Main.class which was created during running my application.

When I want to do docker exec -it <container-name> /bin/bash it says "Error response from daemon: no such id: " Sudo doesnt help.

So I enter the container with sudo docker run -it <cont-id> /bin/bash is it ok? My downloaded file is still missing…

The solution is to type ddocker ps -a get the id of created container. The do docker commit <cont-id> image_name to save changes.

And at the end: docker run -it image_name /bin/bash

Everything works, thanks!