
Learn how Docker containers package and run your Java applications identically across environments, avoiding the works-on-my-machine problem, by building a Dockerfile and leveraging public images, networks, storage, and registry publishing.
Explore how Docker packages applications into isolated containers with the exact runtime, libraries, and environment variables needed, ensuring identical behavior across macOS, Windows, and Linux systems when Docker is installed.
Learn to implement a Docker workflow by creating a Dockerfile that specifies operating system, runtime, and jar to run, then build a Docker image and run it in a container.
Learn to install Docker Desktop on Windows 11, download from docker.com, run the installer, and start the Docker Engine; optionally enable host networking under settings for project use.
Install Docker Desktop on Mac, download from docker.com, drag the app to the applications folder, sign in, and enable host networking in settings to run containers.
Learn to install Docker on Amazon Linux via yum, start the Docker service, add your user to the Docker group, apply changes, and verify with docker version and docker ps.
Discover where to find Docker images in registries like Docker Hub, use search and filters to locate official and verified images, and learn how to download and run them.
Pull the latest mysql docker image from the docker official repository on docker hub, using tags and the pull command, then ensure docker is running and inspect images.
Run a docker container from a downloaded image with docker run, configure MySQL with a root password and a new database named photo app, and use host networking for access.
Create and test a new MySQL Workbench connection to the Docker-hosted server, using host 127.0.0.1 (or localhost), port 3306, and the Sergei credentials to access the photo database.
Learn to manage a MySQL docker container by stopping, starting, viewing logs, following logs with -f, and removing containers using docker stop, docker start, docker logs, and docker rm.
Master using the docker help option to recall commands, explore aliases like docker ps and docker container ls, and discover flags for images, run, environment variables, and published ports.
List docker images, then delete unused ones with docker rmi using repository name and tag or image id; ensure no container uses the image.
Prune unused docker images with a single docker image prune -a command to delete all unused images, freeing disk space while avoiding images in use by containers.
Dockerize a Spring Boot app by building an executable jar with Maven or Gradle. Create a Dockerfile, build a Docker image, run it locally, and push it to a registry.
Build a Spring Boot application to generate a fat jar with all dependencies using the Spring Boot Maven plugin, producing the jar in the target folder for running in Docker.
Create a new docker file for a springboot application using any text editor or IntelliJ, then remove and comment out the default instructions to enable building a docker image.
Understand how to use a base image in Docker to build a small, fast image, for example amazon correto java 23 on alpine for a spring boot app.
Copy the built jar from the target directory into your Docker image using the copy instruction, renaming it to up jar for running your Springboot application in a container.
Apply the entrypoint instruction to run the spring boot executable jar inside a container. Copy the jar into the image and start it with java -jar using the docker file.
Prepare a fresh spring boot jar with mvn clean and mvn package, then build the docker image in the current directory with docker build.
Learn how the entrypoint runs a java app in docker, apply memory limits with -Xmx or memory percentage, and pass spring boot and server parameters at runtime or in image.
Learn how the label instruction adds metadata to a Docker image as key-value pairs, using short or OCI-compliant annotation keys to describe authors, version, title, and description.
Master Dockerfile WORKDIR to set the app folder, ensure subsequent commands run relative to /app, and keep the jar and other files organized.
Define build-time arguments with arg to configure jar files, base image, and version at build time; use them in copy to avoid hard coding and enable flexibility.
Understand how env defines runtime environment variables in Docker, contrasts with arg at build time, and use a log_file_name to pass a java virtual machine system property at runtime.
Use cmd to supply default parameters that can be replaced at runtime, while entrypoint fixes the permanent command for Java apps and spring boot profiles.
Tag and build a Docker image from a Dockerfile for a Spring Boot app. Version tagging enables tracking and rollback; use Maven clean package to prepare the executable jar.
Learn how Docker image naming conventions and tagging best practices work, including repository names, tags, and the role of Docker Hub usernames when pushing images.
Tag Docker images with a meaningful version to enable rollback and safer production, as latest should not be sole tag; use words, digits, or version numbers, and anticipate semantic versioning.
Learn to tag docker images using semantic versioning, with major, minor, and patch updates for backward compatible changes and the option to add meta information to tags.
Discover how Docker image tags use meta information—git commit hashes, version numbers, build numbers, environment names, timestamps, and branch names—to trace builds and guide internal and public tagging.
Discover multistage docker builds that produce smaller, consistent Java images by building the app inside Docker and avoiding large JDK and Maven in the final image.
Understand multi-stage build structure in Docker for Java developers, with three stages: dependencies, build, and runtime. Only the final stage becomes the image, yielding a smaller Java runtime.
Create a new multi-stage dockerfile to build a java jar inside docker, preserving the original dockerfile for future reference and illustrating staged development across lessons.
Create a stage called dependencies in a multi-stage Docker build, install Maven on an Alpine base, set build directory, and copy pom.xml to download and cache dependencies for stage two.
Stage two builds the Spring Boot application by reusing the dependencies stage, copying source code, and running mvn package to create a jar in build/target.
Create a lightweight runtime image with a java runtime base, copy the jar from the builder, and configure a memory-limited entrypoint, using a build-time argument for the base image.
Discover how to build a multi-stage Docker image for a Spring Boot app, using a custom Dockerfile with -f, -t, and build-arg base image to switch runtimes.
Learn to run a Docker container from a prebuilt image using docker run, specify repository and tag, and start a Spring Boot app on port 8082 with the test profile.
Learn to stop a running docker container using Docker Desktop or the docker stop command by selecting the container id in the containers tab.
Publish the container's port to the host using docker run -p to map host port 8082 to container port 8082, verify with docker ps, and access via localhost:8082.
Learn to list docker containers with docker ps and docker container ls, use -a or --all, and filter by image and status.
Learn to delete unused docker containers by listing with docker ps --all, stopping active ones, and removing by container ID or using docker rm with -q for bulk cleanup.
Master how docker run creates new containers, why docker start starts existing containers, and how to manage container names, IDs, stopping, and removing to save disk space.
Set a custom container name with docker run and the name flag to stop, start, and reuse containers, and to enable reliable inter-container communication using container names.
Learn how to run docker containers in attached and detached modes, understand when to use each, and manage start, stop, and reattach logs from the terminal.
Learn to view container logs in attached and detached modes by using Docker logs and Docker start, and follow the logs with the -f flag for real-time streaming.
Override the dockerfile cmd by passing a profile argument at run time to switch between test and prod Spring Boot configurations (including port 8082 and H2 vs MySQL databases).
Set the spring boot profile at runtime via docker environment variables, using -e or --env before the image name, update the Dockerfile, and verify the profile in a running container.
Override Spring Boot configuration at runtime with environment variables, such as setting a different port via docker run, mapping 8081 to the host, and prioritizing runtime values over properties.
Master passing long lists of environment variables by using an environment file with docker run --env-file, keeping the command short and editable.
Learn to use docker exec to open an interactive terminal inside a running container, log into mysql, run show databases, and exit safely.
Learn docker storage options for data persistence: volumes, bind mounts, and tmpfs memory mounts, storing data on the host or in the docker area to survive container destruction.
Use docker run -v to create an anonymous volume stored on the host with a random hash name, delivering fast storage while tying data to a single container.
Use named volumes in docker to create data folders on the host and share data between containers, with Docker managing paths and preserving data after container deletion.
Bind mounts in Docker bind a host folder to a container folder with the -v option, placing the host path on the left and the container path on the right.
Explore tmpfs mounts in Docker on Linux, using in-memory storage for temporary data, with Docker run --tmpfs, mounting logs to host memory, where data is lost when the container stops.
Create an anonymous volume by adding a volume instruction in the final stage of the Dockerfile. Mount it to /app/logs where the logs file users log is written.
Explore how Docker Desktop lists anonymous volumes, how they differ from named ones, and how deleting a container via Desktop removes the volume, unlike terminal deletion.
Learn how to view data in an anonymous docker volume using the docker volume ls, docker inspect, and docker run with a temporary alpine container, mounting the volume to /data.
Learn to inspect a docker container for an anonymous volume using docker inspect and view the mounts to identify the host path and container directory like logs.
Create a named volume with docker volume create, then mount it to container's /app/logs using docker run so the Spring Boot app writes logs to a persistent volume.
View data inside a named volume with Docker CLI by inspecting the mount point. Use Docker Desktop to browse volume contents, noting named volumes persist beyond container lifetimes.
Attach an existing named volume to a new Docker container using the -v option with the volume name to bind it inside the container and reuse previously stored log files.
Delete a named volume using the Docker CLI by listing with docker volume ls and removing with docker volume rm, ensuring the data is deleted when no longer needed.
Demonstrates using a bind mount to map a host folder to the Spring Boot container, storing app logs in a host directory and persisting data beyond container lifecycle.
Use bind mounts to store MySQL data on the host, ensuring persistence after container deletion; map a local folder with -v and reattach data with a new container.
Learn how to use tmpfs mounts in Docker to create in-memory storage for temporary files, caches, uploads, and logs that disappear when the container stops.
Explore how Docker containers stay isolated by default and connect on the same network using bridge, host, none, overlay, or macvlan drivers so containers can talk by name.
Docker assigns IPs on the default bridge network for two containers, enabling container communication by IP; create a custom network to use container names and publish ports 8080 to 8082.
Explore user defined bridge networks in Docker, with built in name resolution, isolation from other networks, and customizable subnet and gateway for stable container names in multi-container apps.
Learn about docker host network mode, where containers share the host’s network namespace, have no docker network, and use host IP and ports, so apps reach services via host.
Run a MySQL server in a docker container on the default bridge network, create a database for the Springboot application, set a root password, and connect via the container's IP.
Build and run a Spring Boot app in Docker with a multi-stage Dockerfile. Override MySQL credentials and JDBC URL via environment variables, set prod profile, and communicate on bridge network.
Show how two docker containers on the default bridge network talk via private IPs and verify access with a curl request to a spring boot app and a MySQL container.
Create a user-defined bridge network named my net with Docker network create, then list and inspect networks to view subnet, gateway, and how containers join this network.
Connect an existing mysql docker container to a user-defined bridge network using docker network connect, then verify with docker inspect to view the added network and DNS access.
Disconnect the MySQL Docker container from the default bridge network using docker network disconnect. Verify the container remains reachable on the user defined network via name or IP.
Launch a new spring boot container on a user defined bridge network, configure environment variables and data source URL to use the MySQL container by name, and verify connectivity.
Test container name DNS resolution on a user defined bridge network by pinging the MySQL container from the Springboot app container using docker exec.
Test a user-defined bridge network with a throwaway BusyBox container using docker run --rm to ping the mysql container and verify DNS resolution.
Learn to run a MySQL container on the host network with --network host, enabling localhost:3306 access and direct host DNS or IP connectivity.
Launch a spring boot application in a docker container using host networking to share the host IP, configure MySQL connection via environment variables, and verify startup without port publishing.
Demonstrate host network by running a spring boot app and a mysql server in separate docker containers, then verify communication via http requests to localhost:8081.
Explore how a bridge-networked spring boot container connects to a host-network mysql container by port mapping and using host docker internal to reach the host, ensuring cross-network communication.
Publish your docker image to Docker Hub by creating a new repository, logging in, choosing public, and pushing the image so you can pull and run it on any computer.
Tag your local docker image with a Docker Hub repository name and version 2.0.1, then push it. Verify the image and its tags on Docker Hub.
Pull a docker image from Docker Hub and run it on any computer with Docker installed using the docker pull command from the repository tags, then docker run.
Learn to log in to Docker Hub, pull an image from a remote Linux server, and run it with port mapping in detached mode, verifying with docker ps.
Learn how docker compose defines all services in a single docker-compose.yaml file to run and manage a multi-container application with one command (docker compose up) from build to deployment.
Stop running containers, prune unused resources with docker container prune, docker image prune --all, and docker system prune --all, then create fresh containers with Docker Compose.
Create a docker compose file in IntelliJ to manage multiple projects from a parent folder, using the default docker-compose.yaml name, and prepare to define containers in the next lesson.
Define and organize docker containers with a services section in a docker-compose.yml, using two-space indentation, service names as hostnames, and best practices for naming.
Set an optional container name to identify the docker container; avoid fixed names to enable scaling, and use service name for docker compose communication, container name for docker commands.
Choose a docker image in the compose file to run mysql; docker pulls the latest official mysql image from docker hub and you can build from scratch with a dockerfile.
Configure environment section in the docker compose file to set MySQL root password, database name, and user. Prefer environment variables or secrets at runtime to avoid hard coding sensitive values.
Learn to run docker compose up with environment variables, either via export or set, explore using environment files, and verify containers with docker ps after starting in foreground or detached.
Docker compose down stops all containers and removes their networks; by default it keeps volumes and images, with -v removing volumes and --rmi removing images, or all removing everything.
Map the MySQL container port to the host using Docker Compose ports, enabling connections from the host to the container's 3306, with port mappings defined as a YAML list.
Explore Docker volumes, including anonymous volumes, bind mounts, and named volumes, and learn how to persist MySQL data across containers for development and production.
Define a Spring Boot service in Docker Compose, connect it with the MySQL service, and learn how to build the image locally with a Dockerfile using the build section.
Set the build context, specify a docker file, and use tags to name and push images in docker compose; learn how image and build sections enable pulling or building locally.
Learn how to use docker compose to pull images from Docker Hub or build locally when missing, with options for detach, no-cache, and pulling base images before building.
Use docker compose depends_on to order container startup, ensuring the mysql container starts before the users service so the Spring Boot app can connect to the database.
Configure a healthcheck in Docker Compose to start the user service after MySQL is healthy, using a MySQL client test (select 1) with interval, timeout, retries, and start period.
Expose port 8082 for the user service in docker compose, then build, run, and test the /users endpoint with curl to confirm MySQL storage and response.
Learn to create a user defined bridge network in Docker Compose, name it, set the bridge driver, and attach services like MySQL and a user container to enable inter-service communication.
Configure Docker to run containers on the host network, removing port mapping. Update data source URLs to localhost or the host ip, since dns names no longer apply.
Place a .env file in the same directory as docker compose file to load environment variables when you run docker compose up, enabling Spring Boot to use h2 in-memory database.
Learn to run Docker Compose with a production environment file to set environment variables, production profile, and database credentials for a Java app.
Learn to replace environment variables with docker compose secrets to securely store sensitive data like database passwords by mounting password files and letting spring read them via a config tree.
Learn to use docker secrets to provide MySQL root and user passwords to a container, reading them from secret files and keeping passwords out of environment variables.
In this video course, you will learn how to use Docker to package and run your Java applications.
This course is designed for beginners, and we’ll start right from the basics of what Docker is and why it has become the standard tool for running applications across different environments.
You will learn:
What Dockerfiles, Docker images, Docker containers, and Docker registries are, and how they all fit together.
How to install Docker on both Mac and Windows, so you can get started no matter what operating system you use.
How to use the most commonly used Docker commands to build images, start containers, and manage your applications.
You will learn how to create Dockerfiles step by step, including how to:
Write a simple Dockerfile to containerize your application.
Create multi-stage Dockerfiles that make your images smaller and faster.
Build Docker images and run them as containers.
You will also learn how to manage containers effectively:
How to start, stop, and inspect containers.
How to connect your containers so they can talk to each other.
How to persist and share data using Named Volumes, Anonymous Volumes, Bind Mounts, and tmpfs storage.
You will also learn about Docker networking and how containers communicate on:
The default bridge network,
User-defined bridge networks,
And the host network mode.
You will learn how to use Docker Compose to build and run multiple containers with one single command!
Finally, you’ll learn how to work with DockerHub:
How to find and pull existing images,
And how to publish your own images so they can be shared with others.
All of this, from the very beginning, to help you confidently start using Docker as a Java developer and take your applications from your laptop to the cloud.