Step 1: Install Docker
Before creating a container, ensure Docker is installed on your machine. Refer to our previous article on setting up Docker for detailed instructions.

Verify the installation by running:

docker --version

Step 2: Pull a Base Image
A Docker image is the blueprint for creating a container. Start by pulling an existing image from Docker Hub. For this example, we’ll use the official `nginx` image:

docker pull nginx

Once downloaded, the image will be stored locally and can be used to create containers.

Step 3: Run a Docker Container
Create and run your first container using the `docker run` command:

docker run --name my-nginx-container -d -p 8080:80 nginx

Explanation:
- `--name my-nginx-container`: Assigns a name to the container.
- `-d`: Runs the container in detached mode (in the background).
- `-p 8080:80`: Maps port 8080 on your host to port 80 in the container.
- `nginx`: Specifies the image to use.

Visit `http://localhost:8080` in your browser. You should see the default NGINX welcome page, confirming your container is running successfully.

Step 4: Interact with the Container
List running containers:

docker ps

Stop the container:

docker stop my-nginx-container

Restart the container:

docker start my-nginx-container

Access the container’s shell:

docker exec -it my-nginx-container bash

Step 5: Build Your Own Image
Create a simple `.NET Framework` application to use in a container. Create a `Dockerfile`:

FROM mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019
WORKDIR /app
COPY /bin/Release /app
ENTRYPOINT ["MyApp.exe"]

Build the Docker image:

docker build -t my-dotnet-app .

Create and run a container from the custom image:

docker run --name my-dotnet-container -d my-dotnet-app

Step 6: Clean Up
Remove a stopped container:

docker rm my-nginx-container

Remove an image:

docker rmi nginx

Conclusion
Congratulations! You’ve created and managed your first Docker container. This foundational knowledge opens the door to exploring more advanced Docker workflows and leveraging its power for real-world applications. Containers streamline application deployment and provide consistent environments, making them an essential tool for modern software development.