
Discover Docker from scratch with practical, hands-on exercises that apply to Java Spring projects; spin up multi-service stacks, databases, and tests with a single command.
Discover how Docker changed packaging and running applications by replacing full operating systems with a lightweight outer layer that uses the host kernel, enabling fast startup and cross-team consistency.
Docker enables developers to package an application with all its dependencies and runtime into a portable image that runs identically across hosts, providing isolation.
Explore how Docker runs on macOS and Windows by using a lightweight Linux kernel virtual machine and Docker Desktop, making setup effortless for developers.
Install docker by downloading the correct installer from get docker for your operating system. Set up the docker desktop app and adjust cpu and memory settings as needed.
Verify Docker is running by checking the Docker daemon and active icon, then use the terminal to run Docker, Docker version, and Docker Compose version, starting the service if needed.
Execute docker system prune -a -f to remove all images, containers, and temporary data, starting from a clean state.
Explore docker images and containers by using docker images, docker run, and docker pull with the hello world image from Docker Hub; see first-pull vs cached runs.
Pull the latest hello world image with docker pull and see how docker run uses cached images. Use docker prune to clean up, and pull again when the image updates.
Pull and run an ubuntu container to see how docker images create environments, including hello world, and how docker run executes commands inside containers and docker ps -a tracks them.
Use docker run -it to start an ubuntu container in interactive mode and attach input output to a shell. Exiting leaves no changes; each run starts a brand-new, stateless container.
Learn to list and name containers with docker ps -a and --name, and start exited containers with docker start in interactive mode.
Learn to stop and kill docker containers—graceful stop with docker stop and immediate termination with docker kill—using names or ids to target instances.
Learn how to use docker exec to run commands in an existing container rather than creating a new one, and access an interactive shell for debugging.
Master the Docker image name format, including host, username, image, and tag, and learn why the latest tag isn’t tied to timestamp.
Learn to pull and run an Nginx container with Docker, select tags like latest or perl, and verify the Nginx welcome page inside the container.
Map a host port to the container port to access engine x from your browser, using docker run -p host:container and visiting http://localhost:hostport.
Discover how to run a Docker container in detached mode with -d, keep the terminal free, and map host port 7070 to container port 80 for browser access.
Access the container log with docker logs using the container id or name to view commands and outputs, including engine x logs in detached mode.
Map host directories to containers with docker volume mapping to exchange files and preserve state, using the -v host_path:container_path syntax with absolute paths under your home directory.
Demonstrates volume mapping by mounting the host current directory into a Docker container, enabling file exchange via shared directories like hello and message.txt.
Use volume mapping to map a host directory to the container, persisting database data and keeping the container's files visible on the host after removal.
Map docker volumes to nginx by mounting the host directory to /usr/share/nginx/html with a custom index.html. Start the container with port mapping and verify access at localhost.
Explore volume mapping to share a single file from a directory using interactive mode. Map index.html into a container to isolate the file, demonstrating selective sharing.
Map a host directory into a container in read-only mode to protect host file system, using Docker run with a read-only volume so files can be read but not deleted.
Learn how Docker containers talk over networks, from the default bridge to a custom bridge, addressing IP address reliability, and explore none, host, and overlay drivers with Kubernetes previews.
Create and test a docker bridge network to enable container communication, inspect the engine X container for its bridge IP, and verify access with curl.
Learn how nginx in a docker network serves its home page without exposing a host port, thanks to container networking and the default bridge network.
Create a custom docker bridge network for a java spring boot development environment, run nginx on it, and enable container-name dns resolution between services, then prune unused resources.
Learn to create a dockerfile and build a docker image from a base image using FROM, ADD, COPY, RUN, ENV, WORKDIR, EXPOSE, ENTRYPOINT, and compare ADD versus COPY.
Build a hello world docker image by creating a Dockerfile, copying a welcome text, and displaying it when container starts. Tag the image with docker build -t and run it.
Rebuild the Docker image using entrypoint instead of command to see how entrypoint executes by default. Understand the key difference between entrypoint and command and how optional arguments work.
Install Java 17 manually in an Ubuntu container by downloading the JDK, extracting it with tar, updating the PATH, and preparing a custom docker image from a base image.
Create a ubuntu-based dockerfile to install openjdk 17, download tarball with curl in a java work directory, set path, and build and run the image to verify java and javac.
Use the add command to download and copy files into a Java 17 base image, replacing curl steps, then build the Docker image and run a container to verify Java.
Compare two docker image techniques, observe how curl and the add command create extra layers and size, then remove dangling images with docker system prune -f.
Master Docker copy usage by copying a source directory into the image and exposing a diff directory. Create a text directory if needed and copy all text files from source.
Learn how to pass environment variables to a Docker container at runtime by building a Java 17-based image, compiling a simple program, and printing the input value.
Compare the shell form and the exact form in Dockerfiles, showing how shell form interprets variables like $PATH while exact form treats them literally during execution.
Demonstrate how docker build creates images from a Dockerfile, highlighting layer caching, repeated builds on file changes, and the impact of rearranging the Dockerfile for faster iterations.
Learn how docker packages an application with its dependencies and runtime into an image, builds that image, and runs it as a container with tags, registries, and dockerfile basics.
Create a docker-compose.yaml with version 3, defining a web service using Engine X. Map port 80 to 80 and run docker compose up to view Engine X at localhost.
Learn how to name and use a custom docker compose file with the -f option, run docker compose up with that file, and remove resources with docker compose down.
Map host directories to the nginx container using docker-compose.yaml, create a data directory with index.html, and experiment with read-only and file-only volume mappings to serve content via curl.
Learn how Docker compose creates a shared network for multiple services, uses service names for inter-container communication, and utilizes depends on to ensure startup order without port mappings.
Learn to pass environment variables from a docker compose yaml to a container, verify them with the env command, and access the variables inside the running app.
Learn how to pass environment variables to docker containers using an env file in docker compose, enabling multiple property files and mixed approaches to expose values inside the container.
Learn how to use environment variable substitution in a docker compose file to dynamically choose the image tag at runtime (default latest) when the variable is unset.
Spin up a MongoDB database and Mongo Express with docker compose, define services in a docker-compose.yaml, and connect them via environment variables.
Map a host data directory to the container's data/db to persist MongoDB data across docker compose down and container restarts.
Learn to initialize a fresh MongoDB with a script that creates a database and products collection, inserts seed records, and integrates with docker-compose for testing.
Compare volume mapping and Dockerfile approaches to initialize a Mongo database, showing how to bake initialization scripts into the image or mount them externally, with version update considerations.
Spin up Postgres and the Adminer UI with Docker Compose, configure environment variables and volumes, and initialize a product table with sample data for verification in Adminer.
Manage containers, networks, volumes, port mappings, and environment variables declaratively with docker compose up and down. Identify the docker-compose.yaml in the current directory and use ps and logs for debugging.
Develop a microservice called job surveys using Spring MVC or Spring Flex, exposing list, search by skill, and post endpoints with a Mongo database, as a step toward Docker infrastructure.
Set up Spring Boot project with Maven or Gradle, choose a Java version, add reactive web, reactive MongoDB, and Lombok, and organize code into controller, dto, entity, repository, and service.
Create a Mongo job entity with Lombok and a static create, implement a reactive repository with a skills query, and provide a dto and util for entity to dto conversion.
Develop a rest controller for jobs exposing endpoints to fetch all jobs, search by skills via request params, and save a job, using flux and mono for reactive responses.
Spin up a real MongoDB with docker-compose and an initialization script to create a database, user, collection, and seed documents for a Java Spring Boot app.
Discover alpine, a lightweight docker image ideal for java deployments and security. Note alpine ships with a minimal shell, so you may install tools like curl yourself.
Compare base image options for Java Spring Boot on Docker Hub, including Eclipse Temurin and BellSoft, and prefer alpine-based OpenJDK 17.0.3 for a small, open-source base.
Explore running a Java Spring Boot app with Docker Compose, connect to MongoDB from a container using environment variables instead of localhost, and rely on Spring's retry logic for readiness.
Master docker compose build workflows by using the build option to automatically build images from your Dockerfile, manage image names or tags, and bring services up with docker compose up.
Use docker compose profiles to selectively start services during development, such as bringing up only Mongo or the job service for testing. Bring services up to verify end-to-end functionality.
Build your spring boot app into a docker image with mvn spring-boot:build-image using build packs, which creates the jar, pulls base images, and tags the image from the pom version.
Master end-to-end docker testing for a java spring boot app, connect to MongoDB via a mongo container, and selectively run services with Docker Compose profiles and inline image builds.
Write an integration test for the job service web app using the spring web test client to call /job/all and verify a 200 status and not empty JSON.
An abstract base test uses a generic container for MongoDB, with a data init file and port mapping, and injects host and port into the Spring Data MongoDB URI.
Run an integration test by launching test containers and pulling images, including a Mongo image. The API endpoint returns the response body as a byte array, with containers cleaned up.
Add a logback.xml to suppress debug logs from test containers and set the MongoDB driver to info, keeping test outputs clean while allowing failures to reveal real issues.
Learn how to extend integration tests by adding search by skills and post endpoints, with predefined test data, json path assertions, and validating responses like id and description.
Open terminal and run mvn clean test to see that only unit tests run; then run mvn clean verify with fail safe plug in to execute unit and integration tests.
Scale integration tests with test containers and docker compose to run multiple services (MongoDB, Postgres, Redis) in a shared network, using a single file for local and integration testing.
Run docker compose up to avoid port conflicts and enable development with mongodb on port 27017, using profiles to bring only mongodb for testing and a separate yaml for tests.
Learn to perform integration testing with test containers, spinning docker containers for databases and message queues, using generic or docker-compose containers, while managing lifecycle with annotations and mindful port mapping.
Develop and expose a candidate service with endpoints for all, by id, and create, backed by MongoDB and a candidate database, with Docker Compose and integration tests.
Set up the Spring project by configuring the group and artifact (candidate service) with MongoDB reactive and Lombok, and plan test containers for integration testing.
Create a candidate entity with id, name, skills, and experience using Lombok and document annotations, then implement a reactive repository and a DTO with converters.
Build a reactive candidate service that fetches all candidates, retrieves a candidate by id, and saves new candidates using a repository, with DTO-to-entity mapping.
Build and expose a simple candidate controller with get all, get by id, and post save endpoints using a service; return and process candidate data in a Spring Boot context.
Update the application properties to configure spring data mongodb with a MongoDB connection string, including username and password, server IP address, port 21017, and database.
Create a Docker Compose file to run Mongo and the candidate service for Java Spring Boot development, with version 3.0, port mappings, and volume mounts for data.
Explains how mvn clean package runs unit tests by default, and how to avoid connecting to mongo by excluding mongo reactive auto configuration and marking the repository bean.
Start and test a multi-service app with Docker Compose using a profile, bringing up Mongo, the candidate service, and other services, then validate endpoints via curl before writing integration tests.
Set up a base integration test using test containers and Docker Compose, configure a Mongo service and dynamic properties for Spring Data MongoDB in a Java Spring Boot project.
Learn to write integration tests by configuring the testing plan, verifying 200 responses for candidate lists and by ID queries, and creating a new candidate such as Dr. Dre.
Review the assignment solution by detailing added spring boot dependencies, entity and repository setup, lombok usage, to/from entity conversions, service logic for candidates, controller mappings, and dockerized test infrastructure.
Run integration tests in the final demo, verify assertions by changing inputs, and enable the fail-safe maven plugin for robust, fast builds.
Learn to integrate the candidate service with the job service using Docker Compose and integration tests, fetching recommender jobs when calling the get candidate endpoint amid agile, parallel development.
Launch the mock server as a docker container with a docker compose file, map port 1080, and initialize via a config file read by an environment variable, using json expectations.
Learn to design and extend DTOs for job responses and candidate details, including recommended jobs, using Lombok, equals, and hashCode, and set up a client to call the job service.
Create a spring-managed job client with a web client to fetch recommended jobs by skills, building the base URL and query parameters, then convert the response to a list.
Update the service and controller to attach recommended jobs to candidate details. Call the job plan client with candidate details and video skills.
Demonstrates wiring a mock job service for the candidate service using a mock server and docker-compose, including creating a JSON data file, defining request expectations, and simulating responses.
Orchestrate a local development stack with Docker Compose, start Mongo and mock services, test integration with the job service, and learn resilience against failures from dependent services.
Learn how to make a Java Spring Boot service resilient by simulating remote errors (404, 500), handling them to return an empty list, and validating robustness with docker compose tests.
Enhance integration tests by wiring mockserver and dependent services via docker compose, map host ports, and introduce a service DTO to manage mongo and job service metadata.
Develop robust integration tests with Mockserver by adding a health endpoint, validating 200 responses, expanding coverage for candidate data, skills, and recommended jobs, and simulating remote service failures.
Run the integration test that starts two services, and note that it will be slow. Ensure enough CPU memory is allocated to the service.
Discover how an api gateway acts as a reverse proxy, exposing microservices through a single port and using path-based routing to reach job and candidate services.
Add a hostname property to candidate and job services to identify which container handles a request in multi-instance deployments, propagating it through DTOs for clearer load-balancing visibility.
Set up a local api gateway project using docker compose to simulate production for microservices like job service and candidate service, with dedicated data and conf directories for nginx.
Create a docker compose file version 3.0 configuring mongo, a job service, a candidate service, and nginx, with data directory volumes and no port mappings for internal service-to-service networking.
Configure nginx as the api gateway for dockerized services, implementing path-based routing with location blocks, exact and prefix matches, and proxy_pass to internal job and candidate services.
Scale containers horizontally by running multiple instances of the job and candidate services with docker compose replicas, allocate resources to the docker process, and let the API gateway balance traffic.
Use docker compose to build and run the api gateway with backend services. Ensure the jar is present, expose port 88, and observe load balancing across candidate and job services.
Add a Bootstrap-based index.html template and implement a JavaScript-driven UI to manage a Docker masterclass for Java Spring Boot developers, loading jobs and candidates via API calls.
Implement frontend navigation-driven data loading for job and candidate lists by fetching data from the backend and rendering it into refreshed tables using async calls.
Implement frontend navigation to fetch jobs and candidates, toggle active states, and disable non-active buttons. Auto-loads jobs on page load for immediate data display.
Configure nginx to serve static resources by adding a slash-based location block and mapping the directory containing index.html in the container.
Explore next topics after the course, including microservices performance strategies, back-end communication options (gRPC, RSocket, Kafka), GraphQL for mobile front-ends, REST vs reactive, and deployment with Docker and Kubernetes.
This course requires you to download Docker Desktop from official docker site. If you are a Udemy Business user, please check with your employer before downloading software.
-
Master Docker for Spring Developers: Boost Your Productivity and Quality with Containerization
Are you a Spring developer looking to level up your skills and increase your productivity? Have you heard about Docker but aren't sure how it can benefit your Java development workflow? Look no further! This comprehensive course is designed specifically for Spring developers who want to learn Docker from scratch and harness its power to enhance their day-to-day development experience.
Why Docker for Java/Spring Developers?
Docker has revolutionized the way applications are built, shipped, and deployed. As a Spring developer, learning Docker can significantly improve your productivity and the quality of your deliverables. Docker allows you to package your applications and their dependencies into lightweight, portable containers, making it easier to build, ship, and run applications consistently across different environments. By embracing containerization, you can streamline your development process, eliminate "works on my machine" issues, and ensure a smooth deployment experience every time.
What You Will Learn
In this hands-on course, we'll take you on a journey from the fundamentals of Docker to advanced containerization techniques tailored for Spring developers. Here's a glimpse of what you'll explore:
Getting Started with Docker:
Learn the story behind Docker's creation and understand its key benefits.
Compare Docker with traditional virtual machines to grasp its unique advantages for developers.
Mastering Docker Commands and Debugging:
Dive deep into Docker commands and learn how to troubleshoot common issues.
Create and manage Docker containers with various run options.
Discover the magic of port mapping and volume mapping to seamlessly connect your containers with the host system.
Creating Custom Docker Images:
Develop your own Docker images to package your Spring applications and their dependencies.
Gain insights into Docker networks and create custom bridge networks for your microservices.
Declarative Container Management with Docker Compose:
Simplify container orchestration using Docker Compose.
Define multi-container applications with ease using the declarative approach.
Manage port mappings and volume mappings efficiently.
Integration Testing with Docker and Test Containers:
Improve your application's quality by writing integration tests using Docker containers.
Master the GenericContainer and ComposeContainer approaches to testing with Test Containers.
Learn how to use Mockserver for testing when dependent services are not ready in a microservices architecture.
Building an API Gateway with Nginx:
Utilize Nginx for path-based routing and load balancing in a microservices environment.
Combine Nginx, microservices, and Docker Compose to simulate a mini cloud locally for comprehensive testing.
Practical Assignments:
Put your skills to the test with practical assignments throughout the course.
Develop a fully functional microservice, Dockerize it, and run it using Docker Compose.
Write integration tests for your application and validate its performance with ease.
Your Journey to Docker Mastery
This course is designed to provide a comprehensive and hands-on learning experience for Spring developers who want to embrace Docker and containerization. Whether you're new to Docker or looking to enhance your existing knowledge, this course has something for you. By the end of the course, you'll be equipped with the skills to efficiently Dockerize your Spring applications, enhance their quality through integration testing, and build scalable microservices that run flawlessly in any environment.
Take the Next Step
Join us on this exciting journey to Docker mastery and unlock the full potential of containerization for your Spring applications. Harness the power of Docker to boost your productivity, improve the quality of your deliverables, and stay ahead in the fast-paced world of Java development. Enroll now and take the first step towards becoming a Docker-savvy Spring developer!