Developers use Docker to eliminate “works on my machine” problems when collaborating on code with co-workers. Operators use Docker to run and manage apps side-by-side in isolated containers to get better compute density. Enterprises use Docker to build agile software delivery pipelines to ship new features faster, more securely and with confidence for both Linux and Windows Server apps. -- docker.com
OS • application • Default command • Running instance of an image • Custom environment variables • Port mappings from container to host • Stores images centrally • New versions are pushed to the registry • Instance pull images when provisioned
the kernel • There are ports of the CLI for Mac and Windows and a runtime using the system hypervisor • Docker for Windows • Using Hyper-V as hypervisor running Alpine Linux • Docker for macOS • Using xhyve as hypervisor running Alpine Linux
versions for old schema • 1.11 current for many enterpise Linux systems • 1.12 first version with new cluster and networking • 1.13 • New version follow year.month schema • 17.03 current version
of Docker • Docker Community edition • Formerly known as Docker • Docker Enterprise edition • Version of Docker with certified support for different OS • Security checked images • Security checked plugins
• exec Run a command in a running container • imagesList images • info Display system-wide information • inspectReturn low-level information on Docker objects • kill Kill one or more running containers • login Log in to a Docker registry • logs Fetch the logs of a container • ps List containers • pull Pull an image or a repository from a registry • push Push an image or a repository to a registry • rm Remove one or more containers • rmi Remove one or more images • run Run a command in a new container • tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
• -d, --detach Run container in background and print container ID • -e, --env list Set environment variables (default []) • -i, --interactive Keep STDIN open even if not attached • --link list Add link to another container (default []) • --name string Assign a name to the container • -p, --publish list Publish a container's port(s) to the host (default []) • --restart string Restart policy to apply when a container exits (default "no") • --rm Automatically remove the container when it exits • -t, --tty Allocate a pseudo-TTY • -v, --volume list Bind mount a volume (default [])
„docker build“ • Images are build following a spec file called „Dockerfile“ • Every line in a Dockerfile creates a new file system layer • Last layer is tagged with the name and represents the image
version of the Alpine based OpenJDK image • docker build -t birthday-java:1 . • Build Docker image named „birthday-java“ with tag „1“ from the current folder • docker run --rm -ti birthday-java:1 • Run Docker image and run Java application
build your application • run all tests • download all dependencies to target/lib • create a Docker image with all jars • you can then run it using • docker run --rm my.registry.host/myAppName:latest • or better add „--restart=always“