Examine the evolution of virtualization technologies from bare metal, virtual machines, and containers and the tradeoffs between them.
Explores the three core Linux features that enable containers to function (cgroups, namespaces, and union filesystems), as well as the architecture of the Docker components.
Install and configure Docker Desktop
Use publicly available container images in your developer workflows and learn how about container data persistence.
Building out a realistic microservice application to containerize.
Write and optimize Dockerfiles and build container images for the components of the example web app.
Use container registries such as Dockerhub to share and distribute container images.
Use Docker and Docker Compose to run the containerized application from Module 5.
Learn best practices for container image and container runtime security.
Explore how to use Docker to interact with containers, container images, volumes, and networks.
Add tooling and configuration to enable improved developer experience when working with containers.
•Developer Experience Wishlist
Deploy containerized applications to production using a variety of approaches.
To demonstrate how actual companies and organizations use Docker and Containers, I created a minimal 3-tier web application.
It has the following components:
Each component is very minimal, but allows us to highlight the important aspects of containerizing and configuring the system.
Before we containerize it though, first we can explore the code and run it on our host system directly.
First, we'll run the Postgres database using the Docker run command. We will pass a POSTGRES_PASSWORD
environment variable, use a volume mount to persist the data outside of the container, and publish port 5432 (the default port that Postgres runs on).
docker run -e POSTGRES_PASSWORD=foobarbaz -v pgdata:/var/lib/postgresql/data -p 5432:5432 -d postgres:15.1-alpine
The Node.js API is located within the api-node
subdirectory. First, ensure that you are using the correct version of Node (19.4 in this example). To install the dependencies, run npm install
in the api-node
directory.
To run the application, execute the following command:
DATABASE_URL=postgres://postgres:foobarbaz@localhost:5432/postgres npm run dev
This will start the API server, listening on port 3000. The API returns the current timestamp and an API key in the JSON response.
The Golang API is located within the api-golang
subdirectory. First, set the GOPATH
environment variable to the appropriate workspace directory. To install the dependencies, run go mod download
in the api-golang
directory.
To run the application, execute the following command:
DATABASE_URL=postgres://postgres:foobarbaz@localhost:5432/postgres go run main.go
This will start the API server, listening on port 8080. The API returns a similar response to the Node.js API, with the current timestamp and an API key in the JSON response.
The React client is located within the client-react
subdirectory. First, ensure that you are using the correct version of Node (19.4 in this example). To install the dependencies, run npm install
in the client-react
directory.
To run the application, execute the following command:
npm run dev
This will start the development server, listening on port 5173. The React app calls both the Node.js and Golang APIs and displays the responses.