Loading

Quipoin Menu

Learn • Practice • Grow

docker / First Container
tutorial

First Container

Now that Docker is installed, let's run your first container. We'll use the official hello-world image, which is designed to test Docker setup.

Running hello-world

Open your terminal (Command Prompt on Windows, Terminal on Mac/Linux) and type:
docker run hello-world

What Happens?

If the hello-world image is not present locally, Docker will automatically pull it from Docker Hub. Then it creates a container from that image and runs it. The container prints a welcome message and exits.

You'll see output similar to:
Hello from Docker!
This message shows that your installation appears to be working correctly.

Exploring the Container Lifecycle

After the container exits, it still exists on your system. You can see it with:
docker ps -a
This lists all containers, including stopped ones. You'll see a container with the image hello-world and status Exited.

Running an Interactive Container

Let's try something more interactive: an Ubuntu container. Run:
docker run -it ubuntu bash
This pulls the Ubuntu image (if not present) and starts a bash shell inside the container. You can run commands like ls, cat /etc/os-release. To exit, type exit.


Two Minute Drill
  • docker run hello-world tests your Docker installation.
  • Docker pulls images automatically if not present locally.
  • Use docker ps -a to see all containers.
  • Interactive mode: docker run -it ubuntu bash gives a shell.

Need more clarification?

Drop us an email at career@quipoinfotech.com