Skip to content

Instantly share code, notes, and snippets.

@wguedex
wguedex / Docker Commands.md
Last active May 8, 2024 19:26
Docker Commands

Docker Commands Summary

1. docker run

Description: Creates and runs a container from a specified image. Example: docker run --name webserver -p 80:80 -d nginx Common Options:

  • -d: Runs the container in detached mode.
  • -p <host_port>:<container_port>: Maps a host port to a container port.
  • -e: Sets an environment variable (e.g., -e MY_VAR=my_value).
  • --rm: Automatically removes the container after it exits.