Docker Commands

Published at: 6/25/2025, 12:00:00 AM
Description: Some basic docker commands you need to know.
Written by: desonglll
Tags: Docker
Cover

Table of Contents

Windows docker-compose

Install Docker

Download Docker for your machine

Install WSL2

Right click Windows icon, open PowerShell(with admin)

wsl --install
wsl --set-default-version 2

Docker Compose file

docker run -d \
  --name sd-pro-backend \
  -p 8000:8000 \
  -e DJANGO_SETTINGS_MODULE=sd_pro.settings \
  -e DEBUG=1 \
  desonglll/sd-pro-backend:latest
docker run -d \
  --name sd-pro-frontend \
  -p 3000:80 \
  desonglll/sd-pro-frontend:latest

ALL IN ONE

docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
docker rmi $(docker images -aq) -f
docker network prune -f
docker volume prune -f
docker system prune -a -f
 
 
docker network create sd-network
docker run -d --name sd-pro-backend --network sd-network -p 8000:8000 \
    -e DJANGO_SETTINGS_MODULE=sd_pro.settings -e DEBUG=1 \
    desonglll/sd-pro-backend:latest
docker run -d --name sd-pro-frontend --network sd-network -p 3000:80 \
    desonglll/sd-pro-frontend:latest

OR

Create a docker-compose.yml file in a folder.

Then paste the following configuration into docker-compose.yml

# docker-compose.yml
services:
  backend:
    image: desonglll/sd-pro-backend:latest
    container_name: sd-pro-backend
    ports:
      - "8000:8000"
    environment:
      - DJANGO_SETTINGS_MODULE=sd_pro.settings
      - DEBUG=1
 
  frontend:
    image: desonglll/sd-pro-frontend:latest
    container_name: sd-pro-frontend
    ports:
      - "3000:80"

Windows + R enter cmd and press enter.

Enter the folder where docker-compose.yml located in using cd command.

Finally, press

docker-compose up -d