Getting Started with Docker

Now that Docker is up and running, let's explore the fundamental actions you can perform with it.

Pulling Images

Docker boasts a vast community with numerous preconfigured images, many maintained by official software developers (e.g., MySQL, Nginx, Jenkins, and more). These images are accessible on Docker Hub, and while you don't need an account to pull images, you'll require one if you plan to host your own.

Creating Images from Dockerfiles

Crafting Docker images involves creating Dockerfiles, detailing the steps to execute based on an existing image.

Creating Containers

When you use an image, you instantiate it, creating a container. Multiple containers can arise from the same image, akin to classes and objects in Object-Oriented Programming.

For a more comprehensive example, let's pull the Nginx image:

docker pull nginx

These basic steps lay the foundation for working with Docker—pulling images, creating custom ones, and generating containers for your applications.

Running Nginx in a Docker Container

Now, let's put our pulled Nginx image to use by running it with the following command:

docker run -p 8080:80 -d nginx