liveBook · Manning

Docker run

As explained in Learn Docker in a Month of Lunches, Second Edition

docker run is a Docker CLI command that creates and starts a container from an image.

docker run creates and starts a container from an image. It lets you package tools and scripts in an image, then run them without asking another person to install the toolchain. section 2.3

Use interactive flags when you need a terminal inside the container:

  • Let Docker pull the image if necessary, then use the container’s command prompt. section 2.3

Connect and inspect

After starting the interactive container, hostname displays its container environment and date displays its current date. docker container ls shows the running container, while docker container logs records terminal output.

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Explains image pulling, interactive flags, terminal access, and basic verification without detailing Docker internals.
Examples
Uses diamol/base:2e with hostname, date, docker container ls, and docker container logs.
What it assumes
Assumes basic command-line familiarity while teaching the terminal connection from the ground up.
What you can do after
Apply it via the Docker CLI to start an interactive container and inspect its running environment.
How it connects
Connects images, containers, terminal sessions, and container inspection commands.

Also explained in

Compare how 4 books explain docker run →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.