Running a container interactively

You will want to run containers in a detached mode; however, there are times when it is very useful to be able to run the container interactively to diagnose issues.

Running a container interactively essentially gives you a shell on the container, and from within the container you can work in the same way, as you would with any other Linux system.

Getting ready

For this recipe, you will need an Ubuntu 14.04 server with Docker installed.

How to do it…

You can start any Docker container in an interactive mode using the following command:

$ sudo docker run -i -t ubuntu /bin/bash

See also

Refer the documentation on Docker at: https://docs.docker.com/articles/basics/.

Get Learning DevOps: Continuously Deliver Better Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.