hello world
$ time docker run debian echo "hello world"
Unable to find image 'debian:latest' locally
debian:latest: The image you are pulling has been verified
1aeada447715: Pull complete
479215127fa7: Pull complete
511136ea3c5a: Already exists
Status: Downloaded newer image for debian:latest
hello world
real 0m15.250s
user 0m0.050s
sys 0m0.027s
16
# Not have an local image
17.
hello world
$ time docker run debian echo "hello world"
hello world
real 0m0.169s
user 0m0.009s
sys 0m0.010s
17
# Have a local image :)
18.
Image size islight weight
18
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
postgres latest 2389997c2ef2 3 days ago 213.3 MB
nginx latest 90081fa15a0c 3 days ago 91.62 MB
mysql latest 335228ceb173 3 days ago 282.6 MB
debian latest 4d6ce913b130 8 days ago 84.98 MB
centos latest 8efe422e6104 2 weeks ago 210 MB
fedora latest 834629358fe2 3 weeks ago 241.3 MB
busybox latest 4986bf8c1536 3 weeks ago 2.433 MB
ubuntu latest ed5a78b7b42b 4 weeks ago 188.3 MB
Docker Registry s
•DockerHub以外にもDockerイメージを保管するためのレジストリ
サービスが存在する。
• DockerHub (official)
• Quay.io
• Google Container Registry
• $(docker pull registry)
64
65.
65
Dockerfile Docker Image
buildPush Provisioning
Case1
• Very simple
• At first, it docker build very slowly,
but after some caching, it build much faster
Docker Hub
66.
66
Docker Image
Dockerfile DockerHub
Push
Automated
Build
Push
Push
GitHub
or
Bitbucket
Provisioning
Case2
• Outsource your docker build
• GitHub or Bitbucket-like
• Automated build is very slow...
67.
67
Docker Base Image
DockerfileDocker Hub
Push
Automated
Build
Push
Hook
GitHub
Dockerfile
Docker Image
Build
FROM
<Base Image>
Case3
Containerized
Commit Push
Docker Hub
Provisioning
Docker Image
Patch
• Incremental update pattern
• Minimize the build process
• It fast
Container
in Machine
Dockerコミュニティの規模
• 10,000,000+ download
•75,000+ repogitories on DockerHub
• 150+ Meetup Groups in 50 countries
• 740+ contributors
• 50,000+ third-party projects on GitHub
• 100+ user-generated case studies available from companies
70
https://www.docker.com/company/aboutus/
Networkネームスペースの分離
99
# ip addr show | egrep "UP|inet"
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP qlen 1000
inet 153.120.104.254/24 brd 153.120.104.255 scope global eth0
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP qlen 1000
inet 192.168.0.1/24 brd 192.168.0.255 scope global eth1
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN
inet 172.17.42.1/16 scope global docker0
$ docker run -it ubuntu /bin/bash
root@8fbffca705a2:/# ip addr show | egrep "UP|inet"
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
inet 127.0.0.1/8 scope host lo
17: eth0: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
inet 172.17.0.4/16 scope global eth0