The Docker Flow
Dockerfile --build--> Image --run--> Container
The image is assembled in layers:
Application code
Software / dependencies
Container base OS
A complete cycle:
# build an image from the Dockerfile in the current directory
docker build -t dockerhandson/java-web-app:1.0 .
# run a container from that image, detached, with a port mapping
docker run -d --name javaapp -p 8080:8080 dockerhandson/java-web-app:1.0
The trailing . is the build context — the directory Docker sends to the daemon and in which
it looks for the Dockerfile. dockerhandson is the repository namespace, typically your Docker Hub
username.