Skip to content

Instantly share code, notes, and snippets.

@prerakmody
Last active June 17, 2025 10:17
Show Gist options
  • Save prerakmody/2c1a341489d75eef13898c3e7f3a19e3 to your computer and use it in GitHub Desktop.
Save prerakmody/2c1a341489d75eef13898c3e7f3a19e3 to your computer and use it in GitHub Desktop.
Docker + WSL (Windows Subsystem for Linux) Commands
  1. Status/Start/Restart
    • systemctl {status, start, stop, restart} docker.service
  2. Cleanup cache
    • docker system prune -a
  3. Config
    • sudo vim /etc/default/docker
  4. docker0 interface
    • ifconfig | grep docker0 (docker0 is Docker's bridge network)
    • Only if firewalls are installed
      • First: check for all services: sudo systemctl list-units --type=service
      • If firewall found, then: sudo firewall-cmd --list-all-zones | grep -E "^[a-z]|interfaces:"
  1. Ports

    • lsof -i :<port>
    • ss -tulnp | grep <port>
    • netstat -tulnp | grep <port>
  2. Firewall: iptables , ufw, firewall-cmd

    • First: check for all services: sudo systemctl list-units --type=service
    • sudo ufw {status, enable, disable, reload}
    • sudo systemctl status iptables --> sudo iptables -L -v
    • sudo firewall-cmd --list-all
  1. Commands

    • Check installed distros: wsl -l -v
    • Set default wsl version for distros (prior to installing): wsl --set-default-version 2
    • Install Ubuntu 22.04: wsl --install -d Ubuntu-24.04
    • Select a specific distro: wsl -d <DistributionName>
    • Delete a specific distro: wsl --unregister <DistributionName>
  2. Docker commands

    • Sample python docker:
      • docker pull python:3.11
      • docker run -it --network=host python:3.11 bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment