Difficulty: Beginner
Estimated Time: 10 minutes

In this lab, we will learn about running containers in interactive mode

Interactive Mode

Terminal Access

  • Create a container using the Ubuntu 16.04 image and connect to STDIN and a terminal:

docker run -it ubuntu:16.04 bash

This command runs the container, attaches to standard input stream, and get a pseudo-terminal. For the container process, we specify bash to get the terminal.

  • Create a file using the touch command: touch test && ls

  • You should see the file created in the root directory of the container. Now exit: exit

  • Run the container once again: docker run -it ubuntu:16.04 bash ls

Where did our file go?