0

I have a docker image running right now, and access it by boot2docker. I use Python on this, with all the libraries installed. My problem is that I can't save any file or images on Docker. I just execute a little script that save an image in jpg format, but nothing is saved. I give all the rights to the repository, and no one error appears. I use cv2.imwrite for saving image. cv2.imread is working.

Thank for the answers!

Opal
  • 81,889
  • 28
  • 189
  • 210
  • possible duplicate of [Docker saving data](http://stackoverflow.com/questions/30960738/docker-saving-data) – Paul Jun 25 '15 at 09:38

1 Answers1

1

What you need to do is to add a volume to you local disk. Then such image will be saved in the directory you specified and survive container starts/stops etc. Here are the docs.

Opal
  • 81,889
  • 28
  • 189
  • 210
  • I will try this answer, I will tell you after if it works or not. Thanks for the quick answer ! – DockerUser Jun 25 '15 at 09:47
  • I created a data volume with this : docker run -d -P --name coucou2 -v /coucou:/app myname/myrepo python exe.py but nothing appears in my Windows repository, and if I execute with the current image, nothing too ... – DockerUser Jun 25 '15 at 15:52
  • @DockerUser, I didn't know You use windows. Please see the following tutorial: https://github.com/boot2docker/boot2docker#folder-sharing, it might be helpful. Let me know if it worked. – Opal Jun 26 '15 at 06:54
  • I tried this morning, so the command lines are running well, but impossible to access to the http://192.168.59.103/data, even with FileZilla or simply in the browser bar or on Windows Explorer. I restarted the VM in VirtualBox, but same error "ERR_CONNECTION_REFUSED". I tried to use the port 2022 too, but same – DockerUser Jun 26 '15 at 09:53
  • What are you trying to achieve? If you need to server the volume's content an HTTP server to do that. – Opal Jun 26 '15 at 09:57
  • In fact, I want to execute a python file that will save files into the server. So I understood that it store files created in the server, but when I want to access to the server I can't because of this error. Maybe I didn't understand well a part – DockerUser Jun 26 '15 at 10:54
  • Where's the script executed? On the host or on image? Unfortunately I'm not windows user so I can't reproduce it. – Opal Jun 27 '15 at 07:08