๐ Running My First Docker Container: Step-by-Step Guide
In this blog, Iโll walk you through how I successfully ran my first Docker container using VS Code and Docker Desktop. From installing Docker to seeing that confetti screen ๐ โ this post has all the screenshots and steps!
๐ Step 1: Open VS Code and Create a Project Folder
- Launch Visual Studio Code.
- Click File > Open Folder and create a new folder (e.g.,
dola-new-docker
). - Open a new terminal inside VS Code (
Ctrl + ~
).
๐ป Step 2: Check Docker Installation and Clone Repo
In the VS Code terminal, run the following commands to verify Docker installation and clone the Docker sample app:
docker --version
docker-compose --version
git clone https://github.com/docker/welcome-to-docker
cd welcome-to-docker
ls
This clones a welcome app with a Dockerfile.
๐ ๏ธ Step 3: Build the Docker Image
Now run the following command to build the Docker image:
docker build -t welcome-to-docker .
If successful, youโll see BUILD FINISHED
in the terminal.
๐ง Step 4: Go to Docker Desktop and Run the Image
- Open Docker Desktop.
- Click on
Images
from the left sidebar. - Locate the image
welcome-to-docker:latest
. - Click Run.
โ๏ธ Step 5: Set Container Port to 8090
When prompted, set the host port to 8090
and click Run.
๐ Step 6: Launch the Application in Your Browser
- Go to the Containers tab in Docker Desktop.
- Click the port link (e.g.,
http://localhost:8090:3000
). - Your browser will open.
๐ Final Output: Success Screen!
Boom! ๐ You should see a Congratulations!!! You ran your first container screen.
๐ฌ Final Thoughts
Running your first Docker container can feel magical. With VS Code and Docker Desktop, itโs simpler than ever. Let me know in the comments if youโd like me to walk you through Docker Compose next!
โ Donโt forget to share your own experience below.
#docker #vscode #devops #containers #tutorial
Top comments (0)