Learn › CI/CD & DevOps

Docker Basics for Windows Admins: Images, Containers and Volumes

Docker for Windows admins: containers vs VMs, commands to run and inspect containers, volumes, ports, and building your first image from a Dockerfile.

Intermediate 11 min read
By Gopinath Karthikeyan

Containers package an application with everything it needs to run – so it behaves the same on a laptop, a test server and production. Many tools you’ll run as an admin (monitoring, CI agents, internal web apps) are now shipped as containers.

Lab: Docker on an Ubuntu VM (sudo apt install docker.io or Docker’s official repository), or Docker Desktop on Windows with WSL2. Examples use Linux containers.

Container vs virtual machine

  Virtual machine Container
Includes A whole OS with its own kernel Just the app and its libraries; shares the host kernel
Start time Minutes Seconds
Size GBs MBs to a few hundred MB
Isolation Strong (hypervisor) Good, but weaker than a VM
Typical use Servers, mixed workloads Applications and services

Linux containers need a Linux kernel; Windows containers run Windows apps on Windows Server. They aren’t interchangeable.

Virtual machines versus containers: what each one shares Virtual machines Virtual machines Containers Containers App A App A App B App B App A App A App B App B Guest OS Guest OS Guest OS Guest OS Container runtime Container runtime Hypervisor Hypervisor Host OS (shared kernel) Host OS(பகிரப்பட்ட kernel) Hardware Hardware Hardware Hardware Full OS each GBs · starts in minutes ஒவ்வொன்றுக்கும்முழு OS GBs · நிமிடங்களில் start Shares the kernel MBs · starts in seconds Kernel-ஐ பகிரும் MBs · விநாடிகளில் start
Each VM carries its own operating system; containers share the host’s kernel and package only the app and its libraries.ஒவ்வொரு VM-க்கும் சொந்த OS; containers host kernel-ஐ பகிர்ந்து app, libraries மட்டும் கொண்டிருக்கும்.

Images and containers

  • An image is a read-only template (like a VM template): nginx:1.27, prom/prometheus.
  • A container is a running instance of an image. You can run many containers from one image.
  • Images come from a registry – Docker Hub, or your company’s private registry.

Everyday commands

docker pull nginx:1.27                     # download an image
docker run -d --name web -p 8080:80 nginx:1.27   # run in background, map host 8080 → container 80
docker ps                                  # running containers
docker ps -a                               # including stopped
docker logs -f web                         # follow logs
docker exec -it web sh                     # open a shell inside
docker stop web && docker rm web           # stop and remove
docker images                              # local images
docker image prune                         # remove unused images

Open http://<host>:8080 – nginx answers.

Data: containers are disposable, volumes aren’t

When you remove a container, anything written inside it is gone. Keep data in volumes or bind mounts:

docker volume create grafana-data
docker run -d --name grafana -p 3000:3000 -v grafana-data:/var/lib/grafana grafana/grafana
docker run -d --name web -p 8080:80 -v /srv/site:/usr/share/nginx/html:ro nginx:1.27

Now you can upgrade the container (remove and run a newer image) without losing data.

Build your own image

Dockerfile:

FROM nginx:1.27
COPY site/ /usr/share/nginx/html/
EXPOSE 80
docker build -t winops/demo-site:1.0 .
docker run -d -p 8081:80 winops/demo-site:1.0

Each instruction creates a layer; layers are cached, so rebuilds are fast.

Docker Compose: several containers together

compose.yaml:

services:
  prometheus:
    image: prom/prometheus
    ports: ["9090:9090"]
    volumes: ["./prometheus.yml:/etc/prometheus/prometheus.yml"]
  grafana:
    image: grafana/grafana
    ports: ["3000:3000"]
    volumes: ["grafana-data:/var/lib/grafana"]
volumes:
  grafana-data:
docker compose up -d
docker compose logs -f
docker compose down

This is how you’d run the Prometheus and Grafana lab in one command.

Good habits

  • Pin versions (nginx:1.27, not latest) so updates are deliberate.
  • Use official or trusted images; scan them for vulnerabilities in your pipeline.
  • Don’t put secrets in images – pass them at runtime.
  • Run as a non-root user inside the container where possible.

FAQ

Will containers replace our Windows servers? Not wholesale. Many Windows apps still run best on VMs. Containers shine for new apps, tools and services that are built for them.

What’s next

Next: Kubernetes concepts for infrastructure engineers.

Practise this topic

Test yourself with free questions on this topic – instant answers and explanations.

Start practice questions

DockerContainersDevOpsIntermediate

Gopinath Karthikeyan

Gopinath Karthikeyan – Windows Site Reliability Engineer with about 12 years in enterprise Windows Server infrastructure, and founder of WinOps Academy. YouTube · LinkedIn

More in CI/CD & DevOps