Docker
Package a Java app into a small, safe container image and run it with confidence.
Take this course in the learning hubLessons
- Containers vs virtual machinesKnow what a container really is, how it differs from a VM, and why Java teams reach for one.
- Images and layersUnderstand how an image is built from stacked read-only layers and why that makes builds fast.
- Your first DockerfileWrite a Dockerfile that packages an executable Java jar and starts it the right way.
- Running containers and portsStart, inspect and stop containers, and map a container port onto your host without guesswork.
- The .dockerignore fileStop shipping junk into the build context and stop it from silently destroying your build cache.
- Choosing a base imageChoose between JDK and JRE, and between Debian, Alpine and distroless, without guessing.
- Multi-stage builds for JavaBuild the jar and run it from one Dockerfile while shipping only the runtime into the image.
- Build cache and image sizeOrder layers so rebuilds take seconds, and keep the final image small on purpose.
- Environment variables and secretsConfigure a container from the outside and keep credentials out of your image history.
- Volumes and persistent dataKeep data alive when a container is replaced, and know when a bind mount is the better tool.
- Networks and service-to-service callsLet containers find and call each other by name instead of chasing IP addresses.
- Docker ComposeDescribe your app and its database in one file and start the whole stack with one command.
- Health checksTell Docker when your app is really ready, and see why unhealthy is not the same as stopped.
- JVM settings inside a containerSize the heap against the container limit so the kernel stops killing your Java process.
- Container lifecycle and restart policiesFollow a container through created, running, exited and removed, then pick a restart policy.
- Registries, tags and digestsPush an image to a registry, and learn why a tag is a moving label and a digest is not.
- Signals and graceful shutdownMake docker stop end your JVM cleanly instead of the daemon killing it ten seconds later.
- Logs: stdout, drivers and rotationSend logs where Docker can see them, and stop the default driver quietly eating the disk.
- Hardening a running containerDrop root, freeze the filesystem and remove capabilities so one bug is not a host takeover.
- Scanning images and the SBOMFind the vulnerable library in your image before somebody else does, and know what to rebuild.
- Multi-architecture builds with buildxBuild one tag that runs on an Apple Silicon laptop and on an amd64 server.
- Building images without a DockerfileUse Jib or Spring Boot buildpacks to get layered, reproducible images straight from Maven.
- Testcontainers for integration testsTest against a real Postgres or Kafka in a throwaway container instead of against a mock.
- Compose profiles and override filesKeep one compose file for the whole team and switch optional services on per environment.
- Reclaiming disk without losing dataFind where the tens of gigabytes went and delete the right things, not your local databases.
- Building and pushing images in CITurn a git tag into a pushed, cached, multi-arch image that you can trace back to a commit.
- What a container actually isNo such kernel object exists - it is namespaces plus cgroups plus a filesystem.
- Layers, OverlayFS and copy-up costWhy deleting a file does not shrink an image, and why one write can copy a gigabyte.
- Hardening an image for productionSmaller attack surface, no root, and dropped capabilities.
- BuildKit: caching, parallelism and reproducibilityCache mounts, parallel stages, and making CI builds fast rather than repetitive.
- Supply chain: digests, SBOMs and signingKnowing what is in an image, and proving it is the one you built.