try docker

17

Upload: raja-soundaramourty

Post on 21-Apr-2017

109 views

Category:

Engineering


3 download

TRANSCRIPT

Page 1: Try docker
Page 2: Try docker

Containers & ImagesRunning Your First Container

Level 1 – Section 1

Page 3: Try docker

What Are Linux Containers?Linux containers are a way to create isolated environments that can run code while sharing a single operating system.

A computer somewhere - could even be the laptop or desktop computer you’re using right now!

Each container is completely isolated from the others

Container 1 Container 2 Container 3

Physical Server + OS

App

Bin/lib

App

Bin/lib

App

Bin/lib

Page 4: Try docker

Why Docker?Managing Linux containers is hard. Docker is a tool that makes it much easier to manage Linux containers.

Application that manages containers behind the scenes

Container 1 Container 2 Container 3

Physical Server + OS

Docker Engine

App

Bin/lib

App

Bin/lib

App

Bin/lib

Page 5: Try docker

How Can Docker Help Me?There are many different ways people can use Docker.

Create contained, controlled dev environment

Share identical dev environment across team

Developers

Testing

IT Ops

Deployment

Bug reporting This is what we’ll focus on in this course

Page 6: Try docker

Installing DockerThe simplest way to install Docker is to download one of the official Docker applications.

Docker for Mac - Community Edition

Docker for Windows - Community Edition

https://go.codeschool.com/install-docker

Applications

Linux AWS

Installation Instructions

Azure Windows Server

Page 7: Try docker

Containers & ImagesAn image is a blueprint for creating a container.

Pre-built images available in Docker Store (and Docker Hub)

Image Container

Page 8: Try docker
Page 9: Try docker

DockerfilesAutomating the Creation of Custom Images

Level 1 – Section 2

Page 10: Try docker

1 open port 80

2 update package manager

3 download a package

4 copy web server config

The Problem: Creating Containers Is ClunkyCreating containers from the command line works, but it quickly gets a little clunky the more customization that you need to do.

Dockerfiles help make this process slightly less manual

Each step modifies the container a little bit

ImageContainer

Page 11: Try docker

Dockerfiles Help You Create ImagesA Dockerfile is a specially formatted text file where you can add a list of instructions that will run and result in a new image that can be used to make a container.

Image ContainerDockerfile

The steps in a Dockerfile are run and turned into a single image

1 open port 80

2 update package manager

3 download a package

4 copy web server config

Page 12: Try docker
Page 13: Try docker

VolumesWorking With Data in Containers

Level 1 – Section 3

Page 14: Try docker

Getting Data Into ContainersIf the image you’re building a container with doesn’t already contain application files, you’ll need an extra step to get them into your container.

Copy a file into a container from the command line

Copy a file into an image with instructions in a Dockerfile

Page 15: Try docker

The Problem: Containers Don’t Persist DataOur containers aren’t really doing much right now because we don’t have a way to get data in them.

Modified data is gone!

Modify files in container

Start container

Stop container

Page 16: Try docker

The Solution: Data VolumesData volumes expose files on your host machine to the container.

Data is still there!

Modify files in data volume

Start container

Stop container

Host Container

Volume

Page 17: Try docker