How to Create a Container for an Ubuntu Linux Distribution in Docker
Step 1: Run Docker Desktop on your Windows machine.
Step 2: Open the Command Prompt (CMD) and type the following command.
docker pull ubuntu
Step 3: Run the following command to create the container.
If the Ubuntu image is not present on your machine:
- Docker will automatically pull the Ubuntu image from Docker Hub, which is Docker’s default image registry.
- Once the image is downloaded, Docker will use it to create and start the container.
- If the Ubuntu image is already present on your machine:
- Docker will skip the pull step and directly use the existing local copy of the Ubuntu image to create and start the container.
docker run -it --name my-ubuntu-container ubuntu
The End…
FAQs:
Q: What is Docker Desktop?
A: Docker Desktop is a software application that allows you to run Docker on your Windows machine.
Q: What is Docker Hub?
A: Docker Hub is a registry of Docker images, including the Ubuntu image used in this example.
Q: What is the purpose of the docker pull command?
A: The docker pull command is used to download the Ubuntu image from Docker Hub if it is not already present on your machine.
Q: What is the purpose of the docker run command?
A: The docker run command is used to create and start a new container based on the specified image.

