From the course: Learning Docker

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Create a Docker container: The short way

Create a Docker container: The short way - Docker Tutorial

From the course: Learning Docker

Create a Docker container: The short way

- [Instructor] Previously we looked at the long way of creating and starting Docker containers. Let's get the short way a try. It would be really inconvenient if we had to create and start containers explicitly every time we wanted to run our app. It would also be inconvenient to have to use Docker ps to know whether our app ran successfully and then use Docker logs to see its output. Fortunately, Docker created a single command that rolls all these steps into one. That command is Docker Run. Let's try running it against our Hello World Docker image from before. To do that, I'm going to just type docker run hello-world, and again, since I want the Linux version for demo purposes, I'll type :linux. That was so much faster. As we can see here, docker run automatically created a container from the hello world image, started it, and attached to the container to show us its output immediately. Another way to think about…

Contents