Tools: Developer Journal..“My First Docker + Nginx Setup on Ubuntu”
A while ago, I decided to learn Docker and, honestly, it turned out to be much simpler than I expected. In this article, I’ll walk you through how I configured Docker on Windows using WSL (Windows Subsystem for Linux) and ran my very first container. If you're a developer using Windows and want to get into Docker, this post is for you. Spoiler: At the end, you’ll see the Nginx welcome page in your browser — and that feeling is amazing 🎉 What is Docker? (In Simple Terms) Docker is a platform that allows you to package your application inside a “container” — an isolated and portable environment that behaves the same way on any machine. Think of it as a sealed box containing everything your app needs to run. Before getting started, you’ll need: ✅ Windows 10 or 11✅ WSL (Windows Subsystem for Linux) enabled✅ A Linux distribution installed (we’ll use Ubuntu)✅ PowerShell running as AdministratorStep 1: Verify and Install WSL WSL allows you to run Linux commands directly on Windows. Let’s first verify whether it’s installed. Option A: List all available distributionswsl --list --online This command will show all Linux distributions available for installation. Option B: Install Ubuntu on WSL (if you don’t already have it)wsl --install -d UbuntuOption C: Check installed distributionswsl --list --verbose This command is very useful because it shows the state and version of each installed distribution. Step 2: Open Ubuntu in WSL From PowerShell, type: You should see something like: Congratulations! You are now inside Ubuntu. From this point on, all commands will be Linux commands. Step 3: Verify and Install Docker First, let’s check if Docker is already installed: If Docker is not installed, you’ll see a message suggesting available packages. Install it with: sudo apt-get install docker.io -y The -y flag automatically answers “yes” to confirmation prompts, saving time. Verify the installationdocker --version You should see something like: Docker version 24.0.xStep 4: Enable and Start the Docker Service Docker is now installed, but we still need to start the service. Enable Docker to start automaticallysudo systemctl enable dockerStart the service immediatelysudo systemctl start dockerStep 5: Fix Permission Errors If you encounter an error like this while running Docker commands: PERMISSION DENIED WHILE TRYING TO CONNECT TO THE DOCKER API AT UNIX:///VAR/RUN/DOCKER.SOCK Don’t worry! This is completely normal. Docker requires special permissions. Add your user to the Docker group: sudo usermod -aG docker your_user Replace your_user with your Linux username. Now you have two options:Option 1 (Recommended): Close and reopen Ubuntuexit Then reopen it from PowerShell: wsl -d UbuntuOption 2: Activate the group immediatelynewgrp dockerVerify everything worksdocker ps If you see an empty table with headers like CONTAINER ID, IMAGE, etc., Docker is working correctly 🎉 Step 6: Run Your First Container (Nginx) Here comes the fun part. Let’s run Nginx, one of the most popular web servers: docker run -d -p 8080:80 nginxWhat does this command do?docker run → Runs a container-d → Runs it in detached mode (background)-p 8080:80 → Maps port 8080 on your machine to port 80 inside the containernginx → The image you want to run (Docker will download it automatically) You should see something similar to: Unable to find image 'nginx:latest' locallylatest: Pulling from library/nginx...Digest: sha256:abc123...Status: Downloaded newer image for nginx:latesta1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6 That last string is your container ID. Your container is now running 🚀 Step 7: Verify the Container is Runningdocker ps You should see your container listed with the status Up. Step 8: The Best Part — Open it in Your Browser Open any browser on Windows (Chrome, Firefox, Edge, etc.) and go to: http://localhost:8080 If everything worked correctly, you’ll see the beautiful Nginx welcome page saying: That feeling when you realize everything is actually working is incredible 🚀 Additional Useful Commands Here are a few Docker commands you’ll probably want to know: View all containers (including stopped ones)docker ps -aStop a containerdocker stop CONTAINER_IDRemove a containerdocker rm CONTAINER_IDView container logsdocker logs CONTAINER_IDLessons Learned ✅ WSL is essential: Without WSL, Docker on Windows can feel complicated. With WSL, the experience becomes much smoother. ✅ Permissions matter: “Permission Denied” errors are completely normal. It’s not a broken installation — you just need the correct user group permissions. ✅ Docker is beginner-friendly: The Docker ecosystem has done an excellent job making containerization accessible. ✅ Documentation is your best friend: If something breaks, check the logs using docker logs. Now that Docker is working, you can: Build your own Dockerfile for a personal applicationExplore Docker Hub and discover thousands of pre-configured imagesLearn Docker Compose for multi-container orchestrationPublish your own images on Docker HubFinal Thoughts My first experience with Docker on Windows was honestly great. The process is clear, well documented, and most importantly — you get immediate results. And that’s one of the best ways to learn. If you’re thinking about learning Docker: Don’t wait any longer. The journey into containerization begins with a simple: Have questions? Ran into problems? Share your experience in the comments — I’d love to hear about your first Docker setup too 💙 References & ResourcesDocker Official DocumentationWSL DocumentationDocker Hub Templates let you quickly answer FAQs or store snippets for re-use. as well , this person and/or