Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi~ Thank you for your sharing! I’m new to Docker, but I think that there is something different from what I know about how the modifications to the container will be dealt with. I noticed that you use “docker run” during the whole process with out an argument “–name <name>”, thus, Docker will create a new container every time, whose name is a random one generated by the docker itself, eg: if you run
docker run -d busybox && docker ps -a
there comes a container whose name is “sleepy_liskov” on my machine, you run it again, another container called “fervent_lalande” is created, they exit at once cause the busybox dose nothing. So, my point is, in your scenario, when you created the file “byebye” in a container without a name given by you, you stop it, and you “docker run” again, the new container is a new one which is definitely not the one with the “byebye” file. But if you use
docker ps -a
you’ll find the container(let’s call it foo_bar) with the “byebye” file, it’s not gone, just stopped. you can use
docker start foo_bar
to restart it. So, when you say stop the container and start it up again, I would think that you mean "docker start " and “docker stop” not “docker run”, the container will be always there with any of your modification until you remove them with
docker rm <name>
So, I guess maybe you try to find the "byebye " file in the wrong place, and it may be a good practice to use the “–name” argument or use the “–rm”. Again, I’m new to Docker, I’ve been stuck for days about how to use volume properly on OS X, 'cause you know, there is another VirtualBox layer between your host and the container, the volume mounted to the container with “-v” has some permission problem, which drives me crazy. Do you have some clue about it~
I am not native english speaker. But i had understood every single row of your excellent article. You have a talent of explanation abstract thing in simple way, thanks a lot Nik!
Quite possibly the clearest and most comprehensive overview of containers I have ever read. Thanks for making the comparison to virtual machines - as a long time VMware guy (since 2002!), I have struggled to wrap my head around the concept and learn where the similarities and differences were. Now, if you could explain how containers compare to, say, a VMware-based virtual application, you’d really win me over :-). BTW…HUGE Digital Ocean fan - I love your site!
Hi,
First of all thanks for the great article. I am particularly interested in sharing data between host and container. I am trying to create a volume that will store screenshots for failed capybara tests but I am having some issues.
My docker file has the following line:
VOLUME ./tmp/screenshot:/tmp/screenshot
I can see the screenshot being saved in the container:
Entonces veo un mensaje de confirmación # features/step_definitions/information_load_steps.rb:24
HTML screenshot: /tmp/screenshot/screenshot_2016-05-24-14-35-14.938.html
Image screenshot: /tmp/screenshot/screenshot_2016-05-24-14-35-14.938.png
But I can’t see anything being created in the host.
Could you please help me figure out what is going on here?
Thanks
Is this still up to date? I think the changes are now persisted in the top RW layer, even if no data volume is mounted. Right?
I tried creating a file an restarting the container. The file was still there…
I do not really get what does the following mean. 3. To share data with other Docker containers
I want to know more about it. Any more info or ref link?
Clearer than this explanation you won’t find thanks Nik this is awesome :)
Hi, thank you for contributing such a clear and comprehensive tutorial for how to set up docker data volumes for what I presume are the most common use cases. Would you be able to give some pointers for how to address the third, more advanced, scenario i.e. sharing the contents of a persistent data volume between multiple containers? I’ve found a few resources about GlusferFS and NFS, but so far nothing as clearly outlined as your article. Cheers
Hi, you wrote: “There’s no way to directly create a “data volume” in Docker, so instead we create a data volume container with a volume attached to it” Actually, from docker 1.9.0 you can directly create volumes without the need of creating data volume containers. See: https://docs.docker.com/engine/reference/commandline/volume_create/
Something definitely has changed regarding volumes. If i don’t specify a custom host path to the volume, i have no issues.
But when i want to run a container with a volume at a custom location on my host, i am not able to use that volume. This happens to me with al images i have tested it with:
[mru@dockster ~]$ docker run -d -v ~/nginxlogs:/var/log/nginx -p 5000:80 -i nginx [mru@dockster ~]$ ls nginxlogs/ [mru@dockster ~]$ docker logs brave_gates nginx: [alert] could not open error log file: open() “/var/log/nginx/error.log” failed (13: Permission denied) 2018/10/27 17:18:14 [emerg] 1#1: open() “/var/log/nginx/error.log” failed (13: Permission denied)
So, the directory gets created, but i am not able to write to it for whatever reason. This happens also when i start docker as root, and also when i specify a directory which is chmodded 777. Has anyone an idea what goes wrong here?