image
Docker Containers
Start course
Difficulty
Beginner
Duration
1h 11m
Students
153
Ratings
4.4/5
Description

Container orchestration is a popular topic at the moment because containers can help to solve problems faced by development and operations teams. However, running containers in production at scale is a non-trivial task. Even with the introduction of orchestration tools, container management isn’t without challenges. Container orchestration is a newer concept for most companies, which means the learning curve is going to be steep. And while the learning curve may be steep, the effort should pay off in the form of standardized deployments, application isolation, and more.

This course is designed to make the learning curve a bit less steep. You'll learn how to use Marathon, a popular orchestration tool, to manage containers with DC/OS.

Learning Objectives

  • You should be able to deploy Mesos and Docker containers
  • You should understand how to use constraints
  • You should understand how to use health checks
  • You should be familiar with App groups and Pods
  • You should be able to perform a rolling upgrade
  • You should understand service discovery and load balancing

Intended Audience

  • Sysadmins
  • Developers
  • DevOps Engineers
  • Site Reliability Engineers

Prerequisites

To get the most from this course, you should already be familiar with DC/OS and containers and be comfortable with using the command line and with editing JSON.

Topics

Lecture What you'll learn
Intro What to expect from this course
Overview A review of container orchestration
Mesos Containers How to deploy Mesos containers
Docker Containers How to deploy Docker containers
Constraints How to constrain containers to certain agents
Health Checks How to ensure services are healthy
App Groups How to form app groups
Pods How to share networking and storage
Rolling Upgrades How to preform a rolling upgrade
Persistence How to use persistent storage
Service Discovery How to use service discovery
Load Balancing How to distribute traffic
Scenario Tie everything together
Summary How to keep learning

If you have thoughts or suggestions for this course, please contact Cloud Academy at support@cloudacademy.com.

Transcript

Welcome back. In the previous lesson we deployed applications using Mesos containers. Now let's see how to deploy a Docker container. The container we're going to deploy is a Java-based Twitter clone called MiniTwit. This is where Docker might have the advantage over Mesos containers. Mesos containers run a process in isolation, however, if you want to run a java-based app or some other language runtime, you need that runtime on the agent.

Docker's image format allows you to include all of this into the container. Okay, let's jump right in by looking at the JSON. So, I'll be using the CLI for the rest of this course for the most part and that's because once you master the CLI, then the UI is going to be cake. Looking at the JSON for this app you can see some of the same familiar properties.

The ID, a /minitwit and we'll have one instance with one CPU and 512 megs of RAM. The interesting part is the container property. It specifies the type of container as a Docker container and then it defines the Docker properties. The image is the image from Docker Hub, the forcePullImage determines if the container is pulled from Docker Hub each time it's deployed or if it can use the cached version.

In this example being set to false means that once it's been downloaded, you can use the cached version. The privileged property determines if the container is being run in privileged mode or not, the portMappings allow you to bind at the ports on the container to the agents and on the bottom here the accepted resource roles has a value in this array here of slave_public which tells Marathon to run this on a public agent.

If you recall from the Fundamentals course there are public and private agents and by default apps run on private agents which aren't accessible to the outside world. Since this is a web application we're going to run this on a public agent which will be accessible from the internet. To create the app, it's the same command that we've used for the Mesos containers, it's dcos marathon app add followed by the name of the JSON file.

Okay, with the deployment created, let's go ahead into the UI and check out the service. It's currently in a deploying state and clicking on the service shows the tasks that make up the service. In this case there's just the one which is now running. Let's check out the app that's running on the container by pasting the URL for the public instance into the browser and there it is.

So, this is MiniTwit running on a public agent in a Docker container. So, with very little effort we now have a Docker container running on a public node and it's accessible on port 80. Now, other than the container engine being different this is very similar to the Mesos containers and that's one of the things I like best about DCOS is that you get a standard way to deploy different types of containers namely Mesos and Docker containers.

From a deployment perspective the biggest difference is the JSON. As you saw there are some additional properties in the JSON that you need to set. However, other than that deploying a single container is so similar that we've come to the end of this lesson. There will be plenty more Docker later in the course including topics such as pods and volumes, however, for now, that's gonna wrap up this lesson.

 

About the Author
Students
101181
Labs
37
Courses
44
Learning Paths
58

Ben Lambert is a software engineer and was previously the lead author for DevOps and Microsoft Azure training content at Cloud Academy. His courses and learning paths covered Cloud Ecosystem technologies such as DC/OS, configuration management tools, and containers. As a software engineer, Ben’s experience includes building highly available web and mobile apps. When he’s not building software, he’s hiking, camping, or creating video games.