Working with an interactive container
In the first chapter, we ran our first Hello World! container to get a feel of how the containerization technology works. In this section, we are going to run a container in an interactive mode. The docker run subcommand takes an image as an input and launches it as a container. You have to pass the -t and -i flags to the docker run subcommand in order to make the container interactive. The -i flag is the key driver, which makes the container interactive by grabbing the standard input (STDIN) of the container. The -t flag allocates a pseudo-TTY or a pseudo terminal (terminal emulator) and then assigns that to the container.
In the following example, we are going to launch an interactive container by using the ubuntu:14.04 image and /bin/bash as the command:
$ sudo docker run -i -t ubuntu:14.04 /bin/bash
Since the ubuntu image has not been downloaded yet, if we use the docker pull subcommand, then we will get the following message and the run command will...