1. Home
  2. Training Library
  3. Microsoft Azure
  4. Courses
  5. Building Containers with Azure DevOps

Anatomy of a Dockerfile

Contents

keyboard_tab
Course Intro
1
Introduction
PREVIEW2m 1s
Course Conclusion
10

The course is part of these learning paths

AZ-304 Exam Preparation: Designing a Microsoft Azure Architecture
course-steps
17
certification
5
lab-steps
8
description
1
AZ-303 Exam Preparation: Technologies for Microsoft Azure Architects
course-steps
28
certification
7
lab-steps
13
description
1
AZ-400 Exam Prep: Microsoft Azure DevOps Solutions
course-steps
17
lab-steps
5
description
1
more_horizSee 1 more
play-arrow
Start course
Overview
DifficultyIntermediate
Duration29m
Students575
Ratings
4.7/5
starstarstarstarstar-half

Description

This course is designed to give you a solid understanding of containers and how they are used in Azure DevOps. It begins by looking at creating deployable images through Docker containers, microservices, and at the various container-related services available in Azure, including Azure Container Instances, the Azure Kubernetes Service, the Azure Container Registry, Azure Service Fabric, and Azure App Service.

The course also looks at Dockerfile and Docker multi-stage builds before finishing with a hands-on demonstration that shows you how to create an Azure Container Registry.

For any feedback relating to this course, please contact us at support@cloudacademy.com

Learning Objectives

  • Learn about Docker and its role in deploying containerized apps
  • Understand how microservices can be used for deploying apps
  • Learn about the container-related services available in Azure
  • Learn about using multi-stage builds when working with Docker
  • Gain a practical understanding of how to create an Azure Container Registry
  • Gain a practical understanding of how to add Docker support to an application

Intended Audience

This course is intended for DevOps professionals who wish to learn how to use containers to design and implement strategies for developing application code and infrastructure that allow for continuous integration, testing, delivery, monitoring, and feedback.

Prerequisites

To get the most from this course, you should have a basic understanding of the Azure platform and of container concepts.

Transcript

Hi there. Welcome to “Anatomy of a Dockerfile”. In this lecture, we’re going to look at a basic Dockerfile, line by line.

Dockerfiles are used by docker build to assemble images. They are essentially text files that contain the commands that are necessary to build an image. On your screen is an example of a very basic Dockerfile. 

FROM ubuntu 

LABEL maintainer="tmitchell@cloudacademy.com" 

ADD appsetup / 

RUN /bin/bash -c 'source $HOME/.bashrc; echo $HOME' 

CMD ["echo", "Hi everybody!"] 

Generally speaking, every image is based off another existing image. In this sample Dockerfile here, line one refers to the parent image that this new image will be based on. The Ubuntu image referred to in line one would be retrieved from either a local cache or from DockerHub.

I should point out here that an image that doesn't have a parent is called a base image. If that were the case here, what we could do with this Dockerfile is completely omit the FROM line altogether. We could also replace it with FROM scratch, instead. However, since we’re using the ubuntu base image, we are referencing it in the file.

The second line in this sample Dockerfile uses the LABEL command to set the email address of the person who maintains the file.

The third line in our example uses the ADD command to add a file, called “appsetup” into the root folder of the image being created.

The fourth line is a RUN command that runs when the image is being created by docker build. This part of the Dockerfile is typically used to configure things within the image. 

The last line in our sample file calls a command that we want to execute once the new container is created from the image.

Of course, every Dockerfile will be different – and they can be as simple or as complex as they need to be.  Simpler, however, is always better than complex, when possible.

For more information, visit the Dockerfile reference URL that you see on your screen:

https://docs.docker.com/engine/reference/builder/

About the Author
Students19926
Courses36
Learning paths8

Tom is a 25+ year veteran of the IT industry, having worked in environments as large as 40k seats and as small as 50 seats. Throughout the course of a long an interesting career, he has built an in-depth skillset that spans numerous IT disciplines. Tom has designed and architected small, large, and global IT solutions.

In addition to the Cloud Platform and Infrastructure MCSE certification, Tom also carries several other Microsoft certifications. His ability to see things from a strategic perspective allows Tom to architect solutions that closely align with business needs.

In his spare time, Tom enjoys camping, fishing, and playing poker.