CmdWiz

7 Streak
Back to vault
Containerization

docker run

docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Functional Description

Creates a writeable container layer over the specified image and starts it using the specified command.

CategoryDocker
Difficultyintermediate

Execution Recipes

Detached Web Server
docker run -d -p 80:80 --name webserver nginx

Runs Nginx in the background (-d), maps local port 80 to container port 80.

Interactive Shell
docker run -it --rm ubuntu /bin/bash

Launches an interactive Ubuntu shell and removes the container upon exit (--rm).

Official Documentation

View the technical reference