Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Added reason to use -it flag #572

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions beginner/chapters/alpine.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ $ docker run alpine /bin/sh

Wait, nothing happened! Is that a bug? Well, no. These interactive shells will exit after running any scripted commands, unless they are run in an interactive terminal - so for this example to not exit, you need to `docker run -it alpine /bin/sh`.

Notice the `-it` flag in this modified command. The flag `-i` tells the Docker daemon to start an interactive session, and `-t` command tells the Docker to attach the terminal of the container to the current terminal.

You are now inside the container shell and you can try out a few commands like `ls -l`, `uname -a` and others. Exit out of the container by giving the `exit` command.


Expand Down