From the course: Learning Docker

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Saving data from containers

Saving data from containers - Docker Tutorial

From the course: Learning Docker

Saving data from containers

- [Instructor] Containers are meant to be disposable. When they're deleted, they're deleted for good. This includes any data you've saved within them. Let me show you an example. I'm going to use Docker run --rm to create and immediately remove a simple Ubuntu container. I'm going to use --entrypoint to tell Docker that I want to run a shell command. Then I'm going to provide the name of the image, ubuntu. Then at the end of this command, I'm going to send the text, Hello there., to a file called /tmp/file with the echo command and print it with the cat command. I'm going to use a couple of arguments to make this work, and there it is. All right, let's give this a try. As we can see, it went and created that file and printed Hello there. to our screen. Now let's see what happens when I try to print this file on my computer. Oh no! Our system said no. Everything you create within a container stays within the…

Contents