Interactive Use of Docker

While Docker is primarily intended as a management system for containerized services, it can also be used for interactive utilities.


Ephemeral Containers

To run an ephemeral container interactively, try:

docker run --interactive --tty --rm alpine:latest

The container will be cleaned up once it stops running.


Running Containers

To open a shell with a running container, try:

docker exec --interactive --tty my-container /bin/sh

A different shell binary can be used, but many images are purposefully slimmed down and will not have anything other than sh(1) installed.


CategoryRicottone