DOCKER
Data:8/10/2018
non-commercial use
1
About Me
Jason(李孟澤)
Experience
Speaker-CNTUG
Graduate Student
Fields
Android
GoLang
Kubernetes
OpenStack
2
Outline
Installation Guide
What is Docker
Register A Docker Hub
Make A DockerFile
Sample Run
Q&A
3
Installation Guide
Prerequisites
OS requirements(Ubuntu)
Bionic 18.04
Artful 17.10
Xenial 16.04 (LTS)
Trusty 14.04 (LTS)
4
Installation Guide
Uninstall old versions
sudo apt-get purge -y docker-engine docker docker.io docker-ce
sudo apt-get autoremove -y --purge docker-engine docker
docker.io docker-ce
sudo rm -rf /var/lib/docker
sudo rm /etc/apparmor.d/docker
sudo groupdel docker
sudo rm -rf /var/run/docker.sock
5
Installation Guide
Setup
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates
curl software-properties-common
curl -fsSL https://download.docker.com/linux/
ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository  "deb [arch=amd64]
https://download.docker.com/linux/ubuntu  $
(lsb_release -cs)  stable"6
Installation Guide
Install
sudo apt-get update
sudo apt-get install docker-ce
Specific version
apt-cache madison docker-ce
sudo apt-get install docker-ce=<VERSION>
7
Installation Guide
Validate
sudo docker ps
8
What is Docker
Was first published in 2013
An open source project
Not a new technology
Run software packages called "containers"
9
What is Docker
1979 chroot
2000 FreeBSD Jails
2000 Linux VServer
2004 Solaris Containers
2005 OpenVZ
2006  Process Containers
2008 LXC
2013 Docker
10
What is Docker
11
What is Docker
So what do we need
Network
Resource
FileSystem
Fast
12
What is Docker
13
What is Docker
14
What is Docker
15
What is Docker
16
What is Docker
17
What is Docker
18
Including three basic concepts
Image

Container

Repository
What is Docker
19
What is Docker
Docker image
built up from a series of layers.
Each layer represents an
instruction
20
Docker uses containers to execute applications.
Each layer except the very last one is read-only.

Build image by Dockerfile

What is Docker
21
What is Docker
particularity Virtual machine Container
Lunch time Mins Secs
Storage capacity Gb Mb
Performance Virtualized Native like
Amount 10~20 1000up
22
What is Docker
Benefits
More efficient virtualization
Easier migration
Easier scale
More simple management
23
Docker Repository
Docker repository is a service that is storing your
docker images.
Repository
Public
Private
24
Docker Repository
Docker registry could be hosted by a third party, as
public or private registry, like one of the following
registries:
Docker Hub
Quay
Google Container Registry
AWS Container Registry
Or you can host the docker registry by yourself!
25
Docker Repository
Now let's sign up for a Docker Hub!
https://hub.docker.com/
26
Docker Repository
Following command to log in your own docker hub:
If you want to logout
27
Make A DockerFile
DockerFile can build images automatically
A text document that contains all the commands 
DockerFiles use a simple domain-specific language(DSL)

If you hate him...there are other ways!!!
28
Make A DockerFile
Now let's look at an example.
We Will talk about it.
official wordpress repository:
https://hub.docker.com/_/wordpress/
29
Make A DockerFile
the FROM command, which tells us what image to
based this off.
In this example, it’s using the php:5.6-apache Docker
image.
If you are interested, you can also study his basic
image.
30
Make A DockerFile
the RUN command, which tells us what runs within
the container at build time.
In this example, it’s using many run command to
build image.
In other words, he added a lot of layers.
31
Make A DockerFile
the VOLUME command, which tells us what
requested a volume during the build time.
Associate the local machine with the container..
We can check it with the docker CLI.
32
Make A DockerFile
the ENV command, which tells us what sets the
environment variables at build time.
In this example, it sets many environment variables
to present this image.
This is like we are setting the environment variables
in the linux system
33
Make A DockerFile
the COPY command, which tells us what copy a file
to the container at build time.(in the same directory
as the Dockerfile) 
In this example, this image copy the shell script to the
container.
You can do this for things like custom configuration
file.
34
Make A DockerFile
the ENTRYPOINT command, which tells us what
runs within the container at the container runtime.
If the command isn’t specified, Docker will use /bin/
sh -c as the default
This command also allows arguments to be set from
the docker run command as well.
35
Make A DockerFile
the CMD command, which tells us what default
argument passed to the ENTRYPOINT at the
container runtime.
In this example, it sets to apache2-foregroundwhich
therefore starts WordPress.
If you’re after more information,CenturyLink Labs
have a great blog article.
36
Sample Run
Now let's do it !
37
38
39

Talk about Docker