From 8f7ee25eb47616e67f709462d6191d6c4aa2a906 Mon Sep 17 00:00:00 2001 From: nived2 Date: Sat, 23 Nov 2024 12:31:25 +0530 Subject: [PATCH] docs: Add Quick Start examples section to docker run documentation Signed-off-by: nived2 --- docs/reference/run.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/reference/run.md b/docs/reference/run.md index db06ad71f669..6419edda9fdc 100644 --- a/docs/reference/run.md +++ b/docs/reference/run.md @@ -14,6 +14,29 @@ isolated process tree separate from the host. This page details how to use the `docker run` command to run containers. +## Quick Start Examples + +Here are some common use cases for `docker run`: + +```console +# Run a container in interactive mode +$ docker run -it ubuntu bash + +# Run a container in the background (detached mode) +$ docker run -d nginx + +# Run a container with port mapping +$ docker run -p 8080:80 nginx + +# Run a container with environment variables +$ docker run -e DB_HOST=localhost -e DB_PORT=5432 myapp + +# Run a container with volume mount +$ docker run -v /host/path:/container/path myapp +``` + +For more detailed examples and explanations, see the sections below. + ## General form A `docker run` command takes the following form: