Docker & Docker Compose - connorethanjay/Champlain-College-CNCS-Notes GitHub Wiki

This document will not be super fleshed out. If you want more specific Docker information, I recommend you check out my Homelab repository, in which I often use Docker containers inside LXC containers for lightweight self-hosting.

Commonly used Docker Commands

  • Docker pull <image_name>

    • This pulls an image from a Docker image repository, but does not run the image.
  • Docker run <image_name>

    • This creates and runs a container, it will search for the image, but it can sometimes fail to find the correct one.
  • Docker start/stop <container_name> OR <container_id>

    • Self explanatory, if a container is paused, use the start command, if you want to pause it, use the stop command.
  • Docker rm <container_name>

    • Removes a stopped container.
  • Docker ps

    • Lists currently running containers, using --all, it will list stopped containers as well.

Docker Compose

I find myself using Docker Compose much more in my home environment. It is simpler and easier for me to customize a container using compose.

Commonly used Docker Compose Commands

  • Docker compose up -d
    • This will run the designated containers in your .yml config file, With the -d flag it will run the container in the background / detached.
⚠️ **GitHub.com Fallback** ⚠️