Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Run container as a daemon

  • inspect
  • logs

In this example we create a Docker image based on busybox and tiny bit of shell command. Specifically we'll run an infinite while-loop and every second we'll print the current date and time.

The first thing we need to do is to build the

FROM busybox
CMD while true; do (date; sleep 1); done
docker build -t mydocker .
docker run -d --rm --name test mydocker
docker inspect test
docker container logs test
docker container attach test
Ctrl-p Ctrl-q