Getting Started with Docker

🐳 Docker & Colima Quick Start Guide

  1. The Engine: Colima
  • Before running any Docker commands, you must start the runtime.
    • Start Colima: colima start (Add --cpu 4 --memory 8 to give it more juice).
    • Check Status: colima status (Confirm it says "running").
    • Stop Colima: colima stop (Powers down the VM to save battery/resources).

2. Docker Basic Commands (The Essentials)

  • Use these to manage individual containers.
    • List running containers: docker ps
    • List ALL containers (even stopped ones): docker ps -a
    • Stop a container: docker stop <container_id_or_name>
    • Start an existing container: docker start <container_id_or_name>
    • See logs for a container: docker logs -f <container_name>

3. Docker Compose (Orchestration)

  • Use these when you have a docker-compose.yml file to run multiple services (like an App + Database).
    • Spin up everything (Background): docker-compose up -d
    • Rebuild and Start: docker-compose up -d --build (Use this if you changed your
      code/Dockerfile).
    • Stop and Remove containers: docker-compose down
    • Stop, Remove, and Wipe Volumes: docker-compose down -v (⚠ Careful: This deletes
      your database data).

4. Housekeeping (Cleaning up space)

  • Docker can eat up disk space quickly. Use these to "factory reset" your environment.
Task Command
Remove a specific image docker rmi <image_id>
Remove a specific volume docker volume rm <volume_name>
Delete all stopped containers docker container prune
Delete all unused images docker image prune -a
The "Nuclear" Option docker system prune -a --volumes
Pro-tip: The docker system prune -a --volumes command is the ultimate "fix-it" whe
things get weird. It removes all stopped containers, unused networks, and all
images/volumes not currently in use.



5. Troubleshooting Cheat Sheet

  • "Cannot connect to the Docker daemon" -> Run colima start .

  • "Port already in use" -> Find the container with docker ps and run docker stop <ID> .

  • "Changes not showing up" -> Run docker-compose up -d --build

Did you find this article useful?