2. What is Docker?
● Application containerization platform.
○ Package. Run Isolated. Shared OS.
● Eases application deployment.
● Uniform environment across multiple computers.
● Benefits:
○ Development teams run applications on identical environments.
○ Isolates applications dependencies from OS dependencies.
4. Docker workflow continued...
● Dockerfile: Creates a repeatable and portable way of building a Docker image. It is passed
to the `docker build` command to create an image.
● Image: An image is an inert, immutable file that is essentially a snapshot of a container.
● Container: A container is a running image. The image is passed to the `docker run` with
different options to create a running instance of the image.
5. Demo Application
● Really basic flask web application with 2 routes.
○ `/`
○ `/hello/<string:name>`
● Walkthrough existing Dockerfile
● Build & run image.
7. Dockerfile Directives
● FROM: This directive initializes a new build stage and sets the base image for subsequent
instructions.
● RUN: Execute any command in a new layer on top of the current image and commit the
results.
● COPY: Copies files or directories from source (first argument) and adds them to the file
system of the container at the destination path (second argument).
● WORKDIR: Sets the working directory for any directive that follows it in the Dockerfile.
● ENTRYPOINT: Allows you to configure a container that will run as an executable. In our
case we run our application.
8. The Image
● As depicted on our Docker workflow chart, the image comes about as a result of instructing
the Docker engine to build the contents of our Dockerfile.
● This is accomplished using the `docker build` command.
9. The Container
● The container is a running image. We achieve this by passing the image we built to `docker
run` command.
10. Elastic Beanstalk
● Service that allows quick deployment and easy management of applications on AWS.
● It allows developers to upload an application while it automatically handles capacity
provisioning, load balancing, monitoring and scaling.
● Elastic Beanstalk leverages different services on AWS e.g. S3, Elastic Load Balancing,
CloudWatch etc. and there are no extra costs incurred when using EB.
● There are numerous ways of interacting with EB i.e. Amazon Web Console, EB CLI & the
API. We will be using the EB CLI and the Amazon Web Console in the demo.
11. EB Application
● Elastic Beanstalk is made up of different components that work together to enable you to
easily manage and deploy your application. The first component is the application.
● An application is a logical collection of EB components including environments, versions
and environment configurations.
● To create an application we run: `eb init`
12. Dockerrun.aws.json
● A Dockerrun.aws.json file describes how to deploy a Docker container as an Elastic
Beanstalk application. This JSON file is specific to Elastic Beanstalk.
NB: There are certain rules to using this file as specified in the official documentation. One that
stood out was this; “When you provide both files i.e. Dockerfile and Dockerrun.aws.json, do not
specify an image in the Dockerrun.aws.json file. Elastic Beanstalk builds and uses the image
described in the Dockerfile and ignores the image specified in the Dockerrun.aws.json file”
13. EB Environment
● An environment is a version that is deployed onto AWS resources.
● Each environment runs only a single application version at a time, however you can run the
same version or different versions in many environments at the same time.
● When you create an environment, Elastic Beanstalk provisions the resources needed to run
the application version you specified. An application version refers to a specific, labeled
iteration of deployable code for a web application.
● We create an environment using: `eb create`
Official Docker Website: https://www.docker.com/what-docker
Containers are a way to package software in a format that can run isolated on a shared operating system. Unlike VMs, containers do not bundle a full operating system - only libraries and settings required to make the software work are needed. This makes for efficient, lightweight, self-contained systems and guarantees that software will always run the same, regardless of where it’s deployed.
Official Dockerfile Reference: https://docs.docker.com/engine/reference/builder/