Containers in 3 Weeks: Part 1
Published by O'Reilly Media, Inc.
Containers are a revolutionary paradigm in software development, allowing you to “build once, run anywhere,” regardless of the technologies, runtimes, and deployment targets you use. The Docker engine is the industry's de facto container runtime; it supports all major operating systems and is in turn supported by downstream productionizing technologies like Kubernetes and Nomad.
In this three-part course, you’ll get hands-on experience running Docker containers, packaging software in Docker images, and performing multicontainer orchestration using Docker Compose. Expert Raju Gandhi starts with the very basics, outlining the terminology and the command-line interface that ships with Docker, so that you can start working with containers. Then you’ll dive deep into the Dockerfile specification, teasing apart the role of each instruction, and discover how Docker Compose enables you to declaratively define and run multiple containers on a machine.
Although you can attend any of the three parts individually, we recommend pursuing the whole course, in this order:
- Week 1: Getting Started with Containers Using Docker
- Week 2: Building Images Using Docker and Dockerfiles
- Week 3: Composing Your Containers Using Docker Compose
Week 1: Getting Started with Containers Using Docker
In the first session, you’ll explore container fundamentals and get your hands dirty with Docker—particularly the Docker command-line interface. Join in to learn the benefits of containers, how to interface with Docker, how to pull and push images, and how to interrogate the Docker runtime.
Week 2: Building Images Using Docker and Dockerfiles
Now that you understand how to use Docker and the Docker CLI, it’s time to package your existing applications in containers. In this course, you’ll discover what it takes to build images using Dockerfiles. You’ll start with the role of the Dockerfile and its place in the Docker workflow. You’ll then walk through the Dockerfile instruction specification, covering key components including FROM, ARG, RUN, ADD/COPY (as well as the .Dockerignore file), USER, ENV, HEALTHCHECK, EXPOSE, and LABEL.
Week 3: Composing Your Containers Using Docker Compose
In the final session, you’ll move from running single containers to running multiple containers on a single host, using Docker Compose. You’ll learn how to compose a set of services together, avoid duplication in your Compose files, and visualize your architecture. Join in to see how Docker Compose lets you work with your services regardless of architecture, code organization, and environments.
APAC friendly time.
What you’ll learn and how you can apply it
By the end of this live online course, you’ll understand:
Week 1: Getting Started with Containers Using Docker
- The benefits of Docker
- How to create a "Hello, World" container and interactive containers
- What a container is and how it differs from a virtual machine
- The Docker lifecycle
Week 2: Building Images Using Docker and Dockerfiles
- The role of Dockerfiles
- The difference between build and run
- The Dockerfile specification and its components (FROM, ADD/COPY, RUN, etc.)
- How to tag images and push them to a registry
Week 3: Composing Your Containers Using Docker Compose
- The role of Docker Compose in your container workflow
- The Docker Compose specification
- How to use Docker Compose agnostic of project layout, architecture, or environmental differences
And you’ll be able to:
Week 1: Getting Started with Containers Using Docker
- Determine what’s running on your machine (and what isn't)
- Remove images and containers you no longer need
- Set up networking and volumes for containers
- Interface with Docker running on your machine
Week 2: Building Images Using Docker and Dockerfiles
- Write Dockerfiles to package your applications and run them in Docker containers
- Use the Dockerfile instruction spec to build images
- Publish your images to a registry
Week 3: Composing Your Containers Using Docker Compose
- Write a Docker Compose file to compose a set of microservices together
- Ensure that services are started in the right order
- Find the right organizational style to fit Docker Compose in your current projects
This live event is for you because...
- You’re a software engineer who wants to better understand containers and see how they fit into your workflow.
- You work in a microservices or DevOps-enabled environment and want to learn how containers can make your lives easier.
- You’re a software architect who wants to leverage containers to enable cloud native applications.
- You’re a member of a centralized DevOps team who wants to produce automation and tooling to serve teams in a polyglot environment.
Prerequisites
- A computer with Docker, Git, a graphical web browser, and a text editor (e.g., VS Code) installed
- A working knowledge of Linux, application development, the Docker command-line interface, and containers
Recommended preparation:
- Read “Working with Docker Containers” (chapter 5 in Docker: Up & Running)
- Please clone this repository https://github.com/looselytyped/docker-compose-workshop and follow the instructions in the README.md
Recommended follow-up:
- Finish Docker: Up & Running, second edition (book)
- Complete Launch a Docker Container (interactive scenario)
- Complete Build Container Images in Docker (interactive scenario)
Schedule
The time frames are only estimates and may vary according to how the class is progressing.
Week 1: Getting Started with Containers Using Docker
Why use Docker? (15 minutes)
- Presentation: Introduction to Docker
- Q&A
Docker images (20 minutes)
- Presentation and hands-on exercise: Using Docker images
- Q&A
Interactive containers (25 minutes)
- Presentation and hands-on exercise: Using docker run
- Q&A
Break (5 minutes)
Container introspection (25 minutes)
- Presentation and hands-on exercises: Using docker exec; using docker exec; using docker logs; using docker inspect
- Q&A
Virtual machines versus containers (10 minutes)
- Presentation: VMs versus containers
The Docker lifecycle (5 minutes)
- Presentation: The Docker lifecycle
Networking with containers (10 minutes)
- Presentation and hands-on exercise: Networking with containers
- Q&A
Break (5 minutes)
Networking containers on the same host (20 minutes)
- Presentation and hands-on exercise: Using named networks
- Q&A
Volumes with containers (40 minutes)
- Presentation and hands-on exercises: Using volume mount; using named volumes
- Q&A
Week 2: Building Images Using Docker and Dockerfiles
The role of Dockerfiles (15 minutes)
- Presentation and hands-on exercise: The role of Dockerfiles
- Q&A
Build your first Docker image (15 minutes)
- Presentation and hands-on exercise: Build your first Docker image
- Q&A
Getting to know the Dockerfile specification: Part 1 (55 minutes)
- Presentation and hands-on exercises: FROM; ARG; RUN; ADD/COPY; the .Dockerignore file
- Q&A
Break (10 minutes)
Getting to know the Dockerfile specification: Part 2 (75 minutes)
- Presentation and hands-on exercises: USER; ENV; HEALTHCHECK; EXPOSE; LABEL
- Q&A
Publishing your images to a registry (10 minutes)
- Presentation and hands-on exercise: Publishing your images to a registry
- Q&A
Week 3: Composing Your Containers Using Docker Compose
Introduction to Docker Compose (5 minutes)
- Presentation: Introduction to Docker Compose
Composing services: Part 1 (55 minutes)
- Presentation and hands-on exercises: The use case; creating your first service; initializing the database; initializing liquibase and setting up the database; having liquibase wait for the database to start; dealing with problems with your setup; creating your application service; defining service using Docker Compose
- Q&A
Break (5 minutes)
Composing services: Part 2 (50 minutes)
- Presentation and hands-on exercises: Rectifying your setup using volume-based semaphore; rectifying your setup by introducing a reverse proxy; dealing with problems with your setup
- Q&A
Decoding the Dockerfile specification (10 minutes)
- Presentation: Decoding the Dockerfile specification
Break (5 minutes)
DRY-ing out your Dockerfiles (20 minutes)
- Presentation and hands-on exercise: DRY-ing out your Dockerfiles
- Q&A
Visualizing and debugging your Docker Compose files (15 minutes)
- Presentation and hands-on exercise: Visualizing Docker Compose
- Q&A
Achieving agnosticism (15 minutes)
- Presentation: Architectural agnosticism; code structure agnosticism; environment agnosticism
- Q&A
Your Instructor
Raju Gandhi
Raju Gandhi is the founder of DefMacro Software as well as a consultant, author, teacher, and speaker at conferences around the world. As a software developer and teacher, he believes in keeping things simple, preferring to understand and explain the “why” as opposed to the “how.” Raju blogs at LooselyTyped.com and lives in Ohio with his wife, Michelle, their three children, Mason, Micah, and Delphine, and furry family members Buddy, Skye, and Princess Zara. Find his contact information at Rajugandhi.com. He’s always looking to make new friends.