DEV Community

Cover image for Running Your First Docker Container from GitHub in VS Code
Habeeb Hameed
Habeeb Hameed

Posted on

Running Your First Docker Container from GitHub in VS Code


๐ŸŽ‰ 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 1

๐Ÿ’ป 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
Enter fullscreen mode Exit fullscreen mode

This clones a welcome app with a Dockerfile.

Step 2

๐Ÿ› ๏ธ Step 3: Build the Docker Image

Now run the following command to build the Docker image:

docker build -t welcome-to-docker .
Enter fullscreen mode Exit fullscreen mode

If successful, youโ€™ll see BUILD FINISHED in the terminal.

Step 3

๐ŸงŠ 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 4

โš™๏ธ Step 5: Set Container Port to 8090

When prompted, set the host port to 8090 and click Run.

Step 5

๐Ÿ”— 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.

Step 6


๐ŸŽŠ Final Output: Success Screen!

Boom! ๐ŸŽ‰ You should see a Congratulations!!! You ran your first container screen.

Success

๐Ÿ’ฌ 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)