#!/usr/bin/env bash # vim: set filetype=sh # # Author: Cody Hiar # Date: 2019-01-15 # # Description: Show how quickly a docker container # can boot up, run a command, and then boot down. # # Set options: # e: Stop script if command fails # u: Stop script if unset variable is referenced # x: Debug, print commands as they are executed # o pipefail: If any command in a pipeline fails it all fails # set -exuo pipefail # Run a container # Time the docker command tells us how long it took # --rm will remove the container after it's done executing # -it is for running the docker process interactively in our # current terminal vs running it as a daemon. # ubuntu:18.04 is the image we want to use, if we don't have # the image downloaded then docker will automatically try # to get it from docker hub # The remainder is the command we're passing to the container time docker run --rm -it ubuntu:18.04 /bin/bash -c 'echo Hello World' # Show size of docker container docker images | grep '18.04'