SlideShare a Scribd company logo
1 of 25
Copyright©2018 NTT Corp. All Rights Reserved.
NTT ソフトウェアイノベーションセンタ
須田 瑛大
Docker 18.09 新機能
Docker Meetup Tokyo #26 (2018/11/21)
https://medium.com/nttlabs
https://slideshare.net/AkihiroSuda
2
Copyright©2018 NTT Corp. All Rights Reserved.
• コンテナ関連OSSのメンテナ(いわゆるコミッタ)を務めている
• Docker Moby メンテナ (2016年11月~)
• 2017年4月,OSSプロジェクトとしてのDockerはMobyに名前が変わった
• 商用製品としてのDockerはMobyをベースとして開発されている
• Moby BuildKitメンテナ (2017年夏 プロジェクト発足時~)
• 次世代 `docker build`
• CNCF containerdメンテナ (2017年9月~)
• Kubernetesなどで利用できる次世代コンテナランタイム
: ≒ :
RHEL Fedora
自己紹介
3
Copyright©2018 NTT Corp. All Rights Reserved.
•BuildKitの正式採用
• 並列ビルド
• コンテキストの差分転送
• キャッシュマウント
• Secretマウント
• SSHマウント
•リモートDockerホストへのSSH接続
Docker 18.09の新機能
11月8日リリース
前回のリリース: 18.06 (7月)
次回のリリース: 19.03
18.09のサポート期間: 7ヶ月
4
Copyright©2018 NTT Corp. All Rights Reserved.
• DAG構造を備える中間言語であるLLBを用いる
• Protocol Buffers形式
• 依存性を正確に表現できるので,キャッシュがよく効く
• 命令を並列実行できる
• LLBは主にDockerfileからコンパイルされる
• Dockerfile以外の言語からのコンパイルも可能 (Heroku, CFのBuildpacksなど)
• 他にも,コンテキストの差分転送などの最適化有り
BuildKit: 次世代 docker build
コンパイル
Dockerfile
LLB DAG
Buildpacksなど
docker-image://alpine
Image
git://foo/bar
docker-image://gcc
Run("apk add ..")Run("make")
3命令を同時に実行できる
2
5
Copyright©2018 NTT Corp. All Rights Reserved.
• DAG構造はマルチステージDockerfileを用いて簡単に記述できる
BuildKit: 次世代 docker build
FROM golang AS stage0
...
RUN go build –o /foo ...
FROM clang AS stage1
...
RUN clang –o /bar ...
FROM debian AS stage2
COPY --from=stage0 /foo /usr/local/bin/foo
COPY --from=stage1 /bar /usr/local/bin/bar
0
2
1
6
Copyright©2018 NTT Corp. All Rights Reserved.
• DAGはマルチステージDockerfileを用いて記述できる
BuildKit: 次世代 `docker build`
FROM golang AS stage0
...
RUN go build –o /foo ...
FROM clang AS stage1
...
RUN clang –o /bar ...
FROM debian AS stage2
COPY --from=stage0 /foo /usr/local/bin/foo
COPY --from=stage1 /bar /usr/local/bin/bar
0
2
1
https://t.co/aUKqQCVmXa より引用
7
Copyright©2018 NTT Corp. All Rights Reserved.
https://t.co/aUKqQCVmXa より引用
8
Copyright©2018 NTT Corp. All Rights Reserved.
https://t.co/aUKqQCVmXa より引用
9
Copyright©2018 NTT Corp. All Rights Reserved.
https://t.co/aUKqQCVmXa より引用
10
Copyright©2018 NTT Corp. All Rights Reserved.
• Dockerfileの最初の行に # syntax = docker/dockerfile:1.0-
experimental を指定すると,非標準の命令を利用できる
• 例: RUN –-mount=type=cache
• コンパイラやパッケージマネージャのキャッシュディレクトリを保持できる
• 将来的には,# syntax = ... を指定しなくても標準で利用できるようになる
新しいDockerfile構文: RUN –-mount=type=cache
# syntax = docker/dockerfile:1.0-experimental
...
RUN --mount=type=cache,target=/root/.cache go build ...
https://github.com/moby/buildkit/pull/442 https://github.com/moby/buildkit/pull/455
11
Copyright©2018 NTT Corp. All Rights Reserved.
https://t.co/aUKqQCVmXa より引用
Docker v18.03比で30倍以上高速!
12
Copyright©2018 NTT Corp. All Rights Reserved.
• S3やSSHの鍵を,RUNコンテナ内に安全にマウントできる
• マウントされるだけなので,出力イメージ内には残らない
• SSHの鍵にパスフレーズを設定している場合は,後述する RUN –-mount=type=ssh を
用いる
• docker build –-secret を用いて鍵ファイルを指定
新しいDockerfile構文: RUN –-mount=type=secret
# syntax = docker/dockerfile:1.0-experimental
...
RUN --mount=type=secret,id=aws,target=/root/.aws/credentials 
aws s3 cp s3://... ...
$ docker build –-secret id=aws,src=~/.aws/credentials ...
https://github.com/moby/buildkit/pull/567
13
Copyright©2018 NTT Corp. All Rights Reserved.
• クライアントのssh-agentソケット(SSH_AUTH_SOCK)に,RUNコンテナから
アクセスできる
• docker build –-ssh を用いてソケットを指定
新しいDockerfile構文: RUN –-mount=type=ssh
# syntax = docker/dockerfile:1.0-experimental
...
RUN --mount=type=ssh git clone ssh://gitlab.com/...
$ eval $(ssh-agent)
$ ssh-add ~/.ssh/id_rsa
(パスフレーズ入力)
$ docker build –-ssh default=$SSH_AUTH_SOCK ...
https://github.com/moby/buildkit/pull/608 https://github.com/moby/buildkit/pull/655
14
Copyright©2018 NTT Corp. All Rights Reserved.
• Heroku・Cloud FoundryのBuildpacksも,`docker build`から直接ビ
ルドできる
• やはりLLBに変換されて実行される
Dockerfile以外の言語
# syntax = tonistiigi/pack
---
applications:
- name: myapp
memory: 128MB
disk_quota: 256MB
random-route: true
buildpack: python_buildpack
command: python hello.py
$ docker build –f manifest.yml ...
https://github.com/tonistiigi/buildkit-pack
15
Copyright©2018 NTT Corp. All Rights Reserved.
• # syntax = … で指定する文字列は,ファイルを読んでLLBを出力するプ
ログラム(フロントエンド)のコンテナイメージのreference文字列
• DockerfileでもBuildpacksでもない,独自のイメージ記述言語のフロン
トエンドをユーザが実装し,利用することも可能
• Dockerfileは今後「方言」に分かれていくかも知れない
• docker/dockerfile:1.0 が「標準語」
1行目に書く # syntax = …
16
Copyright©2018 NTT Corp. All Rights Reserved.
• クライアント側で export DOCKER_BUILDKIT=1 して docker build を実
行するとBuildKitが有効になる
• あるいは, /etc/docker/daemon.json に {“features”:{“buildkit”:true}} と記
述しても有効化できる
• Docker 18.06でも,デーモンをexperimentalモードで実行していれば
BuildKitを有効化できる (Secretマウント,SSHマウントは利用不可)
• BuildKitが有効になっていると docker build の出力が大きく変わる
(次スライド)
BuildKitの使い方
17
Copyright©2018 NTT Corp. All Rights Reserved.
BuildKitの使い方
従来 BuildKitモード
18
Copyright©2018 NTT Corp. All Rights Reserved.
• Dockerソケットへのアクセスを許すことは,ホストのroot権限を与える
ことと同じ
• インターネットへ向けてTCPでlistenするなら,TLSの設定が必須
• でもTLSの設定は面倒・間違いやすい
Dockerソケットの設定
19
Copyright©2018 NTT Corp. All Rights Reserved.
Dockerソケットの設定
https://docs.docker.com/engine/security/https/ より引用
$ openssl genrsa -aes256 -out ca-key.pem 4096
Generating RSA private key, 4096 bit long modulus
................................................................................
................................................................................
............................++
........++
e is 65537 (0x10001)
Enter pass phrase for ca-key.pem:
Verifying - Enter pass phrase for ca-key.pem:
$ openssl req -new -x509 -days 365 -key ca-key.pem -sha256 out ca.pem
Enter pass phrase for ca-key.pem:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:Queensland
Locality Name (eg, city) []:Brisbane
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Docker Inc
Organizational Unit Name (eg, section) []:Sales
Common Name (e.g. server FQDN or YOUR name) []:$HOST
Email Address []:Sven@home.org.au
$ openssl genrsa -out server-key.pem 4096
Generating RSA private key, 4096 bit long modulus .............................
........................................++ ....................................
.............................................................++
e is 65537 (0x10001)
$ openssl req -subj "/CN=$HOST" -sha256 -new -key server-key.pem -out server.csr
$ echo subjectAltName = DNS:$HOST,IP:10.10.10.20,IP:127.0.0.1 >> extfile.cnf
$ echo extendedKeyUsage = serverAuth >> extfile.cnf
$ openssl x509 -req -days 365 -sha256 -in server.csr -CA ca.pem -CAkey ca-
key.pem -CAcreateserial -out server-cert.pem -extfile extfile.cnf
Signature ok subject=/CN=your.host.com
Getting CA Private Key
Enter pass phrase for ca-key.pem:
$ openssl genrsa -out key.pem 4096
Generating RSA private key, 4096 bit long modulus
.........................................................++
................++
e is 65537 (0x10001)
$ openssl req -subj '/CN=client' -new -key key.pem -out client.csr
$ echo extendedKeyUsage = clientAuth >> extfile.cnf
$ openssl x509 -req -days 365 -sha256 -in client.csr -CA ca.pem -CAkey ca-
key.pem -CAcreateserial -out cert.pem -extfile extfile.cnf
Signature ok
subject=/CN=client
Getting CA Private Key
Enter pass phrase for ca-key.pem:
$ rm -v client.csr server.csr
$ chmod -v 0400 ca-key.pem key.pem server-key.pem
$ chmod -v 0444 ca.pem server-cert.pem cert.pem
$ dockerd --tlsverify --tlscacert=ca.pem --tlscert=server-cert.pem --
tlskey=server-key.pem -H=0.0.0.0:2376
$ docker --tlsverify --tlscacert=ca.pem --tlscert=cert.pem --tlskey=key.pem -
H=$HOST:2376 version
20
Copyright©2018 NTT Corp. All Rights Reserved.
Dockerソケットの設定
https://docs.docker.com/engine/security/https/ より引用
$ openssl genrsa -aes256 -out ca-key.pem 4096
Generating RSA private key, 4096 bit long modulus
................................................................................
................................................................................
............................++
........++
e is 65537 (0x10001)
Enter pass phrase for ca-key.pem:
Verifying - Enter pass phrase for ca-key.pem:
$ openssl req -new -x509 -days 365 -key ca-key.pem -sha256 out ca.pem
Enter pass phrase for ca-key.pem:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:Queensland
Locality Name (eg, city) []:Brisbane
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Docker Inc
Organizational Unit Name (eg, section) []:Sales
Common Name (e.g. server FQDN or YOUR name) []:$HOST
Email Address []:Sven@home.org.au
$ openssl genrsa -out server-key.pem 4096
Generating RSA private key, 4096 bit long modulus .............................
........................................++ ....................................
.............................................................++
e is 65537 (0x10001)
$ openssl req -subj "/CN=$HOST" -sha256 -new -key server-key.pem -out server.csr
$ echo subjectAltName = DNS:$HOST,IP:10.10.10.20,IP:127.0.0.1 >> extfile.cnf
$ echo extendedKeyUsage = serverAuth >> extfile.cnf
$ openssl x509 -req -days 365 -sha256 -in server.csr -CA ca.pem -CAkey ca-
key.pem -CAcreateserial -out server-cert.pem -extfile extfile.cnf
Signature ok subject=/CN=your.host.com
Getting CA Private Key
Enter pass phrase for ca-key.pem:
$ openssl genrsa -out key.pem 4096
Generating RSA private key, 4096 bit long modulus
.........................................................++
................++
e is 65537 (0x10001)
$ openssl req -subj '/CN=client' -new -key key.pem -out client.csr
$ echo extendedKeyUsage = clientAuth >> extfile.cnf
$ openssl x509 -req -days 365 -sha256 -in client.csr -CA ca.pem -CAkey ca-
key.pem -CAcreateserial -out cert.pem -extfile extfile.cnf
Signature ok
subject=/CN=client
Getting CA Private Key
Enter pass phrase for ca-key.pem:
$ rm -v client.csr server.csr
$ chmod -v 0400 ca-key.pem key.pem server-key.pem
$ chmod -v 0444 ca.pem server-cert.pem cert.pem
$ dockerd --tlsverify --tlscacert=ca.pem --tlscert=server-cert.pem --
tlskey=server-key.pem -H=0.0.0.0:2376
$ docker --tlsverify --tlscacert=ca.pem --tlscert=cert.pem --tlskey=key.pem -
H=$HOST:2376 version
21
Copyright©2018 NTT Corp. All Rights Reserved.
Dockerソケットの設定
https://blog.trendmicro.co.jp/archives/19773 より引用
22
Copyright©2018 NTT Corp. All Rights Reserved.
• Docker 18.09では,`export DOCKER_HOST=ssh://ユーザ@ホスト`す
るとTLSの代わりにSSHを用いてリモートDockerホストに接続できる
• SSHはホストにDockerをインストールする前に何れにせよ設定するだろ
うから,TLSと違って追加の手間が発生しない
• 単に `ssh -l ユーザ ホスト – docker` コマンドを実行する場合と異な
り,クライアントの ~/.docker/config.json に保存されているレジスト
リ認証情報や,ビルドコンテキストにアクセスすることが可能
リモートDockerホストへのSSH接続
23
Copyright©2018 NTT Corp. All Rights Reserved.
• devicemapper 及び overlay ストレージドライバが非推奨になった
• aufs も19.03から非推奨
• overlay2 が推奨
• json-file に代わるログドライバとしてlocalが導入された
• Protocol Buffersを使うのでオーバヘッドが小さい
• RPM・DEBパッケージ構成が変わった
• docker-ce から docker-ce-cli と containerd.io が分離した
• クライアントだけ欲しい場合は docker-ce-cli だけインストールすれば良い
• Windows Subsystem for Linux ユーザなどに有用かも知れない
• Ubuntu 14.04, Debian 8がサポート外となった
その他の変更点
24
Copyright©2018 NTT Corp. All Rights Reserved.
• RUN –-mount=type=(cache|secret|ssh) の正式採用
• 非rootユーザでのDockerデーモンの実行 (#38050)
• User Namespaceを用いる
• --userns-remap と異なり,コンテナだけではなくDockerデーモンも非rootで実行
• Docker, containerd, runcが抱えうる脆弱性を軽減
• 今すぐ試したいなら https://github.com/rootless-containers/usernetes からバ
イナリを入手できる (DockerだけでなくKubernetesも)
• containerdとの重複コードの除去,軽量化 (#38043)
• Dockerのストレージドライバをcontainerdの実装で置き換える
Docker 19.03・19.09 予想
25
Copyright©2018 NTT Corp. All Rights Reserved.
•BuildKitの正式採用
• 並列ビルド
• コンテキストの差分転送
• キャッシュマウント
• Secretマウント
• SSHマウント
•リモートDockerホストへのSSH接続
Docker 18.09の新機能 まとめ

More Related Content

What's hot

Rootlessコンテナ
RootlessコンテナRootlessコンテナ
RootlessコンテナAkihiro Suda
 
[Container Runtime Meetup] runc & User Namespaces
[Container Runtime Meetup] runc & User Namespaces[Container Runtime Meetup] runc & User Namespaces
[Container Runtime Meetup] runc & User NamespacesAkihiro Suda
 
Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Kohei Tokunaga
 
BuildKitによる高速でセキュアなイメージビルド
BuildKitによる高速でセキュアなイメージビルドBuildKitによる高速でセキュアなイメージビルド
BuildKitによる高速でセキュアなイメージビルドAkihiro Suda
 
OCIランタイムの筆頭「runc」を俯瞰する
OCIランタイムの筆頭「runc」を俯瞰するOCIランタイムの筆頭「runc」を俯瞰する
OCIランタイムの筆頭「runc」を俯瞰するKohei Tokunaga
 
CRX: Container Runtime Executive 
CRX: Container Runtime Executive CRX: Container Runtime Executive 
CRX: Container Runtime Executive imurata8203
 
今話題のいろいろなコンテナランタイムを比較してみた
今話題のいろいろなコンテナランタイムを比較してみた今話題のいろいろなコンテナランタイムを比較してみた
今話題のいろいろなコンテナランタイムを比較してみたKohei Tokunaga
 
20分でわかるgVisor入門
20分でわかるgVisor入門20分でわかるgVisor入門
20分でわかるgVisor入門Shuji Yamada
 
コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門Kohei Tokunaga
 
Introduce that Best practices for writing Dockerfiles
Introduce that Best practices for writing DockerfilesIntroduce that Best practices for writing Dockerfiles
Introduce that Best practices for writing DockerfilesYukiya Hayashi
 
Dockerだけではないコンテナのはなし
DockerだけではないコンテナのはなしDockerだけではないコンテナのはなし
DockerだけではないコンテナのはなしKatsunori Kanda
 
いまさら聞けないDocker - 第5回コンテナ型仮想化の情報交換会@大阪
いまさら聞けないDocker - 第5回コンテナ型仮想化の情報交換会@大阪いまさら聞けないDocker - 第5回コンテナ型仮想化の情報交換会@大阪
いまさら聞けないDocker - 第5回コンテナ型仮想化の情報交換会@大阪Kunihiro TANAKA
 
CAMPHOR- day 2020 - Docker 超入門
CAMPHOR- day 2020 - Docker 超入門CAMPHOR- day 2020 - Docker 超入門
CAMPHOR- day 2020 - Docker 超入門KokiMakita1
 
DockerをRed Hatはどのように見ているのか
DockerをRed Hatはどのように見ているのかDockerをRed Hatはどのように見ているのか
DockerをRed Hatはどのように見ているのかEmma Haruka Iwao
 
OCIv2?!軽量高速なイケてる次世代イメージ仕様の最新動向を抑えよう!
OCIv2?!軽量高速なイケてる次世代イメージ仕様の最新動向を抑えよう!OCIv2?!軽量高速なイケてる次世代イメージ仕様の最新動向を抑えよう!
OCIv2?!軽量高速なイケてる次世代イメージ仕様の最新動向を抑えよう!Kohei Tokunaga
 
今さら聞けない人のためのDocker超入門 – OpenStack最新情報セミナー 2015年4月
今さら聞けない人のためのDocker超入門 – OpenStack最新情報セミナー 2015年4月今さら聞けない人のためのDocker超入門 – OpenStack最新情報セミナー 2015年4月
今さら聞けない人のためのDocker超入門 – OpenStack最新情報セミナー 2015年4月VirtualTech Japan Inc.
 
コンテナ型仮想化とはなんだったのか
コンテナ型仮想化とはなんだったのかコンテナ型仮想化とはなんだったのか
コンテナ型仮想化とはなんだったのかえむ ばーど
 
Docker 基本のおさらい
Docker 基本のおさらいDocker 基本のおさらい
Docker 基本のおさらいNaoki Nagazumi
 
Docker ComposeでMastodonが必要なものを梱包する話
Docker ComposeでMastodonが必要なものを梱包する話Docker ComposeでMastodonが必要なものを梱包する話
Docker ComposeでMastodonが必要なものを梱包する話Masahito Zembutsu
 

What's hot (20)

Rootlessコンテナ
RootlessコンテナRootlessコンテナ
Rootlessコンテナ
 
[Container Runtime Meetup] runc & User Namespaces
[Container Runtime Meetup] runc & User Namespaces[Container Runtime Meetup] runc & User Namespaces
[Container Runtime Meetup] runc & User Namespaces
 
Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Dockerからcontainerdへの移行
Dockerからcontainerdへの移行
 
BuildKitによる高速でセキュアなイメージビルド
BuildKitによる高速でセキュアなイメージビルドBuildKitによる高速でセキュアなイメージビルド
BuildKitによる高速でセキュアなイメージビルド
 
OCIランタイムの筆頭「runc」を俯瞰する
OCIランタイムの筆頭「runc」を俯瞰するOCIランタイムの筆頭「runc」を俯瞰する
OCIランタイムの筆頭「runc」を俯瞰する
 
CRX: Container Runtime Executive 
CRX: Container Runtime Executive CRX: Container Runtime Executive 
CRX: Container Runtime Executive 
 
今話題のいろいろなコンテナランタイムを比較してみた
今話題のいろいろなコンテナランタイムを比較してみた今話題のいろいろなコンテナランタイムを比較してみた
今話題のいろいろなコンテナランタイムを比較してみた
 
20分でわかるgVisor入門
20分でわかるgVisor入門20分でわかるgVisor入門
20分でわかるgVisor入門
 
コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門コンテナ未経験新人が学ぶコンテナ技術入門
コンテナ未経験新人が学ぶコンテナ技術入門
 
Introduce that Best practices for writing Dockerfiles
Introduce that Best practices for writing DockerfilesIntroduce that Best practices for writing Dockerfiles
Introduce that Best practices for writing Dockerfiles
 
Dockerだけではないコンテナのはなし
DockerだけではないコンテナのはなしDockerだけではないコンテナのはなし
Dockerだけではないコンテナのはなし
 
いまさら聞けないDocker - 第5回コンテナ型仮想化の情報交換会@大阪
いまさら聞けないDocker - 第5回コンテナ型仮想化の情報交換会@大阪いまさら聞けないDocker - 第5回コンテナ型仮想化の情報交換会@大阪
いまさら聞けないDocker - 第5回コンテナ型仮想化の情報交換会@大阪
 
CAMPHOR- day 2020 - Docker 超入門
CAMPHOR- day 2020 - Docker 超入門CAMPHOR- day 2020 - Docker 超入門
CAMPHOR- day 2020 - Docker 超入門
 
DockerをRed Hatはどのように見ているのか
DockerをRed Hatはどのように見ているのかDockerをRed Hatはどのように見ているのか
DockerをRed Hatはどのように見ているのか
 
OCIv2?!軽量高速なイケてる次世代イメージ仕様の最新動向を抑えよう!
OCIv2?!軽量高速なイケてる次世代イメージ仕様の最新動向を抑えよう!OCIv2?!軽量高速なイケてる次世代イメージ仕様の最新動向を抑えよう!
OCIv2?!軽量高速なイケてる次世代イメージ仕様の最新動向を抑えよう!
 
今さら聞けない人のためのDocker超入門 – OpenStack最新情報セミナー 2015年4月
今さら聞けない人のためのDocker超入門 – OpenStack最新情報セミナー 2015年4月今さら聞けない人のためのDocker超入門 – OpenStack最新情報セミナー 2015年4月
今さら聞けない人のためのDocker超入門 – OpenStack最新情報セミナー 2015年4月
 
コンテナ型仮想化とはなんだったのか
コンテナ型仮想化とはなんだったのかコンテナ型仮想化とはなんだったのか
コンテナ型仮想化とはなんだったのか
 
Docker 基本のおさらい
Docker 基本のおさらいDocker 基本のおさらい
Docker 基本のおさらい
 
Docker ComposeでMastodonが必要なものを梱包する話
Docker ComposeでMastodonが必要なものを梱包する話Docker ComposeでMastodonが必要なものを梱包する話
Docker ComposeでMastodonが必要なものを梱包する話
 
Docker超入門
Docker超入門Docker超入門
Docker超入門
 

Similar to Docker 18.09 新機能

成長を加速する minne の技術基盤戦略
成長を加速する minne の技術基盤戦略成長を加速する minne の技術基盤戦略
成長を加速する minne の技術基盤戦略Hiroshi SHIBATA
 
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】Masahito Zembutsu
 
「さくらのクラウド」スタートアップスクリプトを作ってみよう! - concrete5を題材に -(オープンソースカンファレンス2014 Shimane)
「さくらのクラウド」スタートアップスクリプトを作ってみよう! - concrete5を題材に -(オープンソースカンファレンス2014 Shimane)「さくらのクラウド」スタートアップスクリプトを作ってみよう! - concrete5を題材に -(オープンソースカンファレンス2014 Shimane)
「さくらのクラウド」スタートアップスクリプトを作ってみよう! - concrete5を題材に -(オープンソースカンファレンス2014 Shimane)さくらインターネット株式会社
 
OpenStack Liberty をインストールしてみた
OpenStack Liberty をインストールしてみたOpenStack Liberty をインストールしてみた
OpenStack Liberty をインストールしてみたTakashi Umeno
 
SolidFire を Kibana(ELK Stack)で可視化(需要予測)する
SolidFire を Kibana(ELK Stack)で可視化(需要予測)するSolidFire を Kibana(ELK Stack)で可視化(需要予測)する
SolidFire を Kibana(ELK Stack)で可視化(需要予測)するKensuke Maeda
 
Osc fukuoka xAI Meetup
Osc fukuoka xAI MeetupOsc fukuoka xAI Meetup
Osc fukuoka xAI Meetupru pic
 
オトナのDocker入門
オトナのDocker入門オトナのDocker入門
オトナのDocker入門Tsukasa Kato
 
Apache cloudstack4.0インストール
Apache cloudstack4.0インストールApache cloudstack4.0インストール
Apache cloudstack4.0インストールYasuhiro Arai
 
Docker hands on nifty sakura jul19
Docker hands on nifty sakura jul19Docker hands on nifty sakura jul19
Docker hands on nifty sakura jul19Masahito Zembutsu
 
Circle ci and docker+serverspec
Circle ci and docker+serverspecCircle ci and docker+serverspec
Circle ci and docker+serverspecTsuyoshi Yamada
 
Rancher/Kubernetes入門ハンズオン資料~第2回さくらとコンテナの夕べ #さくらの夕べ 番外編
 Rancher/Kubernetes入門ハンズオン資料~第2回さくらとコンテナの夕べ #さくらの夕べ 番外編 Rancher/Kubernetes入門ハンズオン資料~第2回さくらとコンテナの夕べ #さくらの夕べ 番外編
Rancher/Kubernetes入門ハンズオン資料~第2回さくらとコンテナの夕べ #さくらの夕べ 番外編Masahito Zembutsu
 
Cld018 コンテナ go_~あなた
Cld018 コンテナ go_~あなたCld018 コンテナ go_~あなた
Cld018 コンテナ go_~あなたTech Summit 2016
 
Cld018 コンテナ go_~あなた
Cld018 コンテナ go_~あなたCld018 コンテナ go_~あなた
Cld018 コンテナ go_~あなたTech Summit 2016
 
Apache CloudStack 4.0 インストール(ver0.5)
Apache CloudStack 4.0 インストール(ver0.5)Apache CloudStack 4.0 インストール(ver0.5)
Apache CloudStack 4.0 インストール(ver0.5)Yasuhiro Arai
 
【dots. IT勉強会】開発環境のDocker化
【dots. IT勉強会】開発環境のDocker化【dots. IT勉強会】開発環境のDocker化
【dots. IT勉強会】開発環境のDocker化Yuki Kanazawa
 
Dockerを使ったローカルでの開発から本番環境へのデプロイまで
Dockerを使ったローカルでの開発から本番環境へのデプロイまでDockerを使ったローカルでの開発から本番環境へのデプロイまで
Dockerを使ったローカルでの開発から本番環境へのデプロイまでRyo Nakamaru
 

Similar to Docker 18.09 新機能 (20)

成長を加速する minne の技術基盤戦略
成長を加速する minne の技術基盤戦略成長を加速する minne の技術基盤戦略
成長を加速する minne の技術基盤戦略
 
Hbstudy41 auto scaling
Hbstudy41 auto scalingHbstudy41 auto scaling
Hbstudy41 auto scaling
 
hbstudy37 doc
hbstudy37 dochbstudy37 doc
hbstudy37 doc
 
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
 
「さくらのクラウド」スタートアップスクリプトを作ってみよう! - concrete5を題材に -(オープンソースカンファレンス2014 Shimane)
「さくらのクラウド」スタートアップスクリプトを作ってみよう! - concrete5を題材に -(オープンソースカンファレンス2014 Shimane)「さくらのクラウド」スタートアップスクリプトを作ってみよう! - concrete5を題材に -(オープンソースカンファレンス2014 Shimane)
「さくらのクラウド」スタートアップスクリプトを作ってみよう! - concrete5を題材に -(オープンソースカンファレンス2014 Shimane)
 
OpenStack Liberty をインストールしてみた
OpenStack Liberty をインストールしてみたOpenStack Liberty をインストールしてみた
OpenStack Liberty をインストールしてみた
 
SolidFire を Kibana(ELK Stack)で可視化(需要予測)する
SolidFire を Kibana(ELK Stack)で可視化(需要予測)するSolidFire を Kibana(ELK Stack)で可視化(需要予測)する
SolidFire を Kibana(ELK Stack)で可視化(需要予測)する
 
Open Source x AI
Open Source x AIOpen Source x AI
Open Source x AI
 
Osc fukuoka xAI Meetup
Osc fukuoka xAI MeetupOsc fukuoka xAI Meetup
Osc fukuoka xAI Meetup
 
オトナのDocker入門
オトナのDocker入門オトナのDocker入門
オトナのDocker入門
 
Apache cloudstack4.0インストール
Apache cloudstack4.0インストールApache cloudstack4.0インストール
Apache cloudstack4.0インストール
 
Docker hands on nifty sakura jul19
Docker hands on nifty sakura jul19Docker hands on nifty sakura jul19
Docker hands on nifty sakura jul19
 
Circle ci and docker+serverspec
Circle ci and docker+serverspecCircle ci and docker+serverspec
Circle ci and docker+serverspec
 
Vagrant on SoftLayer
Vagrant on SoftLayerVagrant on SoftLayer
Vagrant on SoftLayer
 
Rancher/Kubernetes入門ハンズオン資料~第2回さくらとコンテナの夕べ #さくらの夕べ 番外編
 Rancher/Kubernetes入門ハンズオン資料~第2回さくらとコンテナの夕べ #さくらの夕べ 番外編 Rancher/Kubernetes入門ハンズオン資料~第2回さくらとコンテナの夕べ #さくらの夕べ 番外編
Rancher/Kubernetes入門ハンズオン資料~第2回さくらとコンテナの夕べ #さくらの夕べ 番外編
 
Cld018 コンテナ go_~あなた
Cld018 コンテナ go_~あなたCld018 コンテナ go_~あなた
Cld018 コンテナ go_~あなた
 
Cld018 コンテナ go_~あなた
Cld018 コンテナ go_~あなたCld018 コンテナ go_~あなた
Cld018 コンテナ go_~あなた
 
Apache CloudStack 4.0 インストール(ver0.5)
Apache CloudStack 4.0 インストール(ver0.5)Apache CloudStack 4.0 インストール(ver0.5)
Apache CloudStack 4.0 インストール(ver0.5)
 
【dots. IT勉強会】開発環境のDocker化
【dots. IT勉強会】開発環境のDocker化【dots. IT勉強会】開発環境のDocker化
【dots. IT勉強会】開発環境のDocker化
 
Dockerを使ったローカルでの開発から本番環境へのデプロイまで
Dockerを使ったローカルでの開発から本番環境へのデプロイまでDockerを使ったローカルでの開発から本番環境へのデプロイまで
Dockerを使ったローカルでの開発から本番環境へのデプロイまで
 

More from Akihiro Suda

20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
20240321 [KubeCon EU Pavilion] Lima.pdf_
20240321 [KubeCon EU Pavilion] Lima.pdf_20240321 [KubeCon EU Pavilion] Lima.pdf_
20240321 [KubeCon EU Pavilion] Lima.pdf_Akihiro Suda
 
20240320 [KubeCon EU Pavilion] containerd.pdf
20240320 [KubeCon EU Pavilion] containerd.pdf20240320 [KubeCon EU Pavilion] containerd.pdf
20240320 [KubeCon EU Pavilion] containerd.pdfAkihiro Suda
 
20240201 [HPC Containers] Rootless Containers.pdf
20240201 [HPC Containers] Rootless Containers.pdf20240201 [HPC Containers] Rootless Containers.pdf
20240201 [HPC Containers] Rootless Containers.pdfAkihiro Suda
 
[Podman Special Event] Kubernetes in Rootless Podman
[Podman Special Event] Kubernetes in Rootless Podman[Podman Special Event] Kubernetes in Rootless Podman
[Podman Special Event] Kubernetes in Rootless PodmanAkihiro Suda
 
[KubeConNA2023] Lima pavilion
[KubeConNA2023] Lima pavilion[KubeConNA2023] Lima pavilion
[KubeConNA2023] Lima pavilionAkihiro Suda
 
[KubeConNA2023] containerd pavilion
[KubeConNA2023] containerd pavilion[KubeConNA2023] containerd pavilion
[KubeConNA2023] containerd pavilionAkihiro Suda
 
[DockerConハイライト] OpenPubKeyによるイメージの署名と検証.pdf
[DockerConハイライト] OpenPubKeyによるイメージの署名と検証.pdf[DockerConハイライト] OpenPubKeyによるイメージの署名と検証.pdf
[DockerConハイライト] OpenPubKeyによるイメージの署名と検証.pdfAkihiro Suda
 
[CNCF TAG-Runtime] Usernetes Gen2
[CNCF TAG-Runtime] Usernetes Gen2[CNCF TAG-Runtime] Usernetes Gen2
[CNCF TAG-Runtime] Usernetes Gen2Akihiro Suda
 
[DockerCon 2023] Reproducible builds with BuildKit for software supply chain ...
[DockerCon 2023] Reproducible builds with BuildKit for software supply chain ...[DockerCon 2023] Reproducible builds with BuildKit for software supply chain ...
[DockerCon 2023] Reproducible builds with BuildKit for software supply chain ...Akihiro Suda
 
The internals and the latest trends of container runtimes
The internals and the latest trends of container runtimesThe internals and the latest trends of container runtimes
The internals and the latest trends of container runtimesAkihiro Suda
 
[KubeConEU2023] Lima pavilion
[KubeConEU2023] Lima pavilion[KubeConEU2023] Lima pavilion
[KubeConEU2023] Lima pavilionAkihiro Suda
 
[KubeConEU2023] containerd pavilion
[KubeConEU2023] containerd pavilion[KubeConEU2023] containerd pavilion
[KubeConEU2023] containerd pavilionAkihiro Suda
 
[Container Plumbing Days 2023] Why was nerdctl made?
[Container Plumbing Days 2023] Why was nerdctl made?[Container Plumbing Days 2023] Why was nerdctl made?
[Container Plumbing Days 2023] Why was nerdctl made?Akihiro Suda
 
[FOSDEM2023] Bit-for-bit reproducible builds with Dockerfile
[FOSDEM2023] Bit-for-bit reproducible builds with Dockerfile[FOSDEM2023] Bit-for-bit reproducible builds with Dockerfile
[FOSDEM2023] Bit-for-bit reproducible builds with DockerfileAkihiro Suda
 
[CNCF TAG-Runtime 2022-10-06] Lima
[CNCF TAG-Runtime 2022-10-06] Lima[CNCF TAG-Runtime 2022-10-06] Lima
[CNCF TAG-Runtime 2022-10-06] LimaAkihiro Suda
 
[KubeCon EU 2022] Running containerd and k3s on macOS
[KubeCon EU 2022] Running containerd and k3s on macOS[KubeCon EU 2022] Running containerd and k3s on macOS
[KubeCon EU 2022] Running containerd and k3s on macOSAkihiro Suda
 
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...Akihiro Suda
 
[KubeCon EU 2021] Introduction and Deep Dive Into Containerd
[KubeCon EU 2021] Introduction and Deep Dive Into Containerd[KubeCon EU 2021] Introduction and Deep Dive Into Containerd
[KubeCon EU 2021] Introduction and Deep Dive Into ContainerdAkihiro Suda
 
[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020Akihiro Suda
 

More from Akihiro Suda (20)

20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
20240321 [KubeCon EU Pavilion] Lima.pdf_
20240321 [KubeCon EU Pavilion] Lima.pdf_20240321 [KubeCon EU Pavilion] Lima.pdf_
20240321 [KubeCon EU Pavilion] Lima.pdf_
 
20240320 [KubeCon EU Pavilion] containerd.pdf
20240320 [KubeCon EU Pavilion] containerd.pdf20240320 [KubeCon EU Pavilion] containerd.pdf
20240320 [KubeCon EU Pavilion] containerd.pdf
 
20240201 [HPC Containers] Rootless Containers.pdf
20240201 [HPC Containers] Rootless Containers.pdf20240201 [HPC Containers] Rootless Containers.pdf
20240201 [HPC Containers] Rootless Containers.pdf
 
[Podman Special Event] Kubernetes in Rootless Podman
[Podman Special Event] Kubernetes in Rootless Podman[Podman Special Event] Kubernetes in Rootless Podman
[Podman Special Event] Kubernetes in Rootless Podman
 
[KubeConNA2023] Lima pavilion
[KubeConNA2023] Lima pavilion[KubeConNA2023] Lima pavilion
[KubeConNA2023] Lima pavilion
 
[KubeConNA2023] containerd pavilion
[KubeConNA2023] containerd pavilion[KubeConNA2023] containerd pavilion
[KubeConNA2023] containerd pavilion
 
[DockerConハイライト] OpenPubKeyによるイメージの署名と検証.pdf
[DockerConハイライト] OpenPubKeyによるイメージの署名と検証.pdf[DockerConハイライト] OpenPubKeyによるイメージの署名と検証.pdf
[DockerConハイライト] OpenPubKeyによるイメージの署名と検証.pdf
 
[CNCF TAG-Runtime] Usernetes Gen2
[CNCF TAG-Runtime] Usernetes Gen2[CNCF TAG-Runtime] Usernetes Gen2
[CNCF TAG-Runtime] Usernetes Gen2
 
[DockerCon 2023] Reproducible builds with BuildKit for software supply chain ...
[DockerCon 2023] Reproducible builds with BuildKit for software supply chain ...[DockerCon 2023] Reproducible builds with BuildKit for software supply chain ...
[DockerCon 2023] Reproducible builds with BuildKit for software supply chain ...
 
The internals and the latest trends of container runtimes
The internals and the latest trends of container runtimesThe internals and the latest trends of container runtimes
The internals and the latest trends of container runtimes
 
[KubeConEU2023] Lima pavilion
[KubeConEU2023] Lima pavilion[KubeConEU2023] Lima pavilion
[KubeConEU2023] Lima pavilion
 
[KubeConEU2023] containerd pavilion
[KubeConEU2023] containerd pavilion[KubeConEU2023] containerd pavilion
[KubeConEU2023] containerd pavilion
 
[Container Plumbing Days 2023] Why was nerdctl made?
[Container Plumbing Days 2023] Why was nerdctl made?[Container Plumbing Days 2023] Why was nerdctl made?
[Container Plumbing Days 2023] Why was nerdctl made?
 
[FOSDEM2023] Bit-for-bit reproducible builds with Dockerfile
[FOSDEM2023] Bit-for-bit reproducible builds with Dockerfile[FOSDEM2023] Bit-for-bit reproducible builds with Dockerfile
[FOSDEM2023] Bit-for-bit reproducible builds with Dockerfile
 
[CNCF TAG-Runtime 2022-10-06] Lima
[CNCF TAG-Runtime 2022-10-06] Lima[CNCF TAG-Runtime 2022-10-06] Lima
[CNCF TAG-Runtime 2022-10-06] Lima
 
[KubeCon EU 2022] Running containerd and k3s on macOS
[KubeCon EU 2022] Running containerd and k3s on macOS[KubeCon EU 2022] Running containerd and k3s on macOS
[KubeCon EU 2022] Running containerd and k3s on macOS
 
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
 
[KubeCon EU 2021] Introduction and Deep Dive Into Containerd
[KubeCon EU 2021] Introduction and Deep Dive Into Containerd[KubeCon EU 2021] Introduction and Deep Dive Into Containerd
[KubeCon EU 2021] Introduction and Deep Dive Into Containerd
 
[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020[KubeCon NA 2020] containerd: Rootless Containers 2020
[KubeCon NA 2020] containerd: Rootless Containers 2020
 

Docker 18.09 新機能

  • 1. Copyright©2018 NTT Corp. All Rights Reserved. NTT ソフトウェアイノベーションセンタ 須田 瑛大 Docker 18.09 新機能 Docker Meetup Tokyo #26 (2018/11/21) https://medium.com/nttlabs https://slideshare.net/AkihiroSuda
  • 2. 2 Copyright©2018 NTT Corp. All Rights Reserved. • コンテナ関連OSSのメンテナ(いわゆるコミッタ)を務めている • Docker Moby メンテナ (2016年11月~) • 2017年4月,OSSプロジェクトとしてのDockerはMobyに名前が変わった • 商用製品としてのDockerはMobyをベースとして開発されている • Moby BuildKitメンテナ (2017年夏 プロジェクト発足時~) • 次世代 `docker build` • CNCF containerdメンテナ (2017年9月~) • Kubernetesなどで利用できる次世代コンテナランタイム : ≒ : RHEL Fedora 自己紹介
  • 3. 3 Copyright©2018 NTT Corp. All Rights Reserved. •BuildKitの正式採用 • 並列ビルド • コンテキストの差分転送 • キャッシュマウント • Secretマウント • SSHマウント •リモートDockerホストへのSSH接続 Docker 18.09の新機能 11月8日リリース 前回のリリース: 18.06 (7月) 次回のリリース: 19.03 18.09のサポート期間: 7ヶ月
  • 4. 4 Copyright©2018 NTT Corp. All Rights Reserved. • DAG構造を備える中間言語であるLLBを用いる • Protocol Buffers形式 • 依存性を正確に表現できるので,キャッシュがよく効く • 命令を並列実行できる • LLBは主にDockerfileからコンパイルされる • Dockerfile以外の言語からのコンパイルも可能 (Heroku, CFのBuildpacksなど) • 他にも,コンテキストの差分転送などの最適化有り BuildKit: 次世代 docker build コンパイル Dockerfile LLB DAG Buildpacksなど docker-image://alpine Image git://foo/bar docker-image://gcc Run("apk add ..")Run("make") 3命令を同時に実行できる 2
  • 5. 5 Copyright©2018 NTT Corp. All Rights Reserved. • DAG構造はマルチステージDockerfileを用いて簡単に記述できる BuildKit: 次世代 docker build FROM golang AS stage0 ... RUN go build –o /foo ... FROM clang AS stage1 ... RUN clang –o /bar ... FROM debian AS stage2 COPY --from=stage0 /foo /usr/local/bin/foo COPY --from=stage1 /bar /usr/local/bin/bar 0 2 1
  • 6. 6 Copyright©2018 NTT Corp. All Rights Reserved. • DAGはマルチステージDockerfileを用いて記述できる BuildKit: 次世代 `docker build` FROM golang AS stage0 ... RUN go build –o /foo ... FROM clang AS stage1 ... RUN clang –o /bar ... FROM debian AS stage2 COPY --from=stage0 /foo /usr/local/bin/foo COPY --from=stage1 /bar /usr/local/bin/bar 0 2 1 https://t.co/aUKqQCVmXa より引用
  • 7. 7 Copyright©2018 NTT Corp. All Rights Reserved. https://t.co/aUKqQCVmXa より引用
  • 8. 8 Copyright©2018 NTT Corp. All Rights Reserved. https://t.co/aUKqQCVmXa より引用
  • 9. 9 Copyright©2018 NTT Corp. All Rights Reserved. https://t.co/aUKqQCVmXa より引用
  • 10. 10 Copyright©2018 NTT Corp. All Rights Reserved. • Dockerfileの最初の行に # syntax = docker/dockerfile:1.0- experimental を指定すると,非標準の命令を利用できる • 例: RUN –-mount=type=cache • コンパイラやパッケージマネージャのキャッシュディレクトリを保持できる • 将来的には,# syntax = ... を指定しなくても標準で利用できるようになる 新しいDockerfile構文: RUN –-mount=type=cache # syntax = docker/dockerfile:1.0-experimental ... RUN --mount=type=cache,target=/root/.cache go build ... https://github.com/moby/buildkit/pull/442 https://github.com/moby/buildkit/pull/455
  • 11. 11 Copyright©2018 NTT Corp. All Rights Reserved. https://t.co/aUKqQCVmXa より引用 Docker v18.03比で30倍以上高速!
  • 12. 12 Copyright©2018 NTT Corp. All Rights Reserved. • S3やSSHの鍵を,RUNコンテナ内に安全にマウントできる • マウントされるだけなので,出力イメージ内には残らない • SSHの鍵にパスフレーズを設定している場合は,後述する RUN –-mount=type=ssh を 用いる • docker build –-secret を用いて鍵ファイルを指定 新しいDockerfile構文: RUN –-mount=type=secret # syntax = docker/dockerfile:1.0-experimental ... RUN --mount=type=secret,id=aws,target=/root/.aws/credentials aws s3 cp s3://... ... $ docker build –-secret id=aws,src=~/.aws/credentials ... https://github.com/moby/buildkit/pull/567
  • 13. 13 Copyright©2018 NTT Corp. All Rights Reserved. • クライアントのssh-agentソケット(SSH_AUTH_SOCK)に,RUNコンテナから アクセスできる • docker build –-ssh を用いてソケットを指定 新しいDockerfile構文: RUN –-mount=type=ssh # syntax = docker/dockerfile:1.0-experimental ... RUN --mount=type=ssh git clone ssh://gitlab.com/... $ eval $(ssh-agent) $ ssh-add ~/.ssh/id_rsa (パスフレーズ入力) $ docker build –-ssh default=$SSH_AUTH_SOCK ... https://github.com/moby/buildkit/pull/608 https://github.com/moby/buildkit/pull/655
  • 14. 14 Copyright©2018 NTT Corp. All Rights Reserved. • Heroku・Cloud FoundryのBuildpacksも,`docker build`から直接ビ ルドできる • やはりLLBに変換されて実行される Dockerfile以外の言語 # syntax = tonistiigi/pack --- applications: - name: myapp memory: 128MB disk_quota: 256MB random-route: true buildpack: python_buildpack command: python hello.py $ docker build –f manifest.yml ... https://github.com/tonistiigi/buildkit-pack
  • 15. 15 Copyright©2018 NTT Corp. All Rights Reserved. • # syntax = … で指定する文字列は,ファイルを読んでLLBを出力するプ ログラム(フロントエンド)のコンテナイメージのreference文字列 • DockerfileでもBuildpacksでもない,独自のイメージ記述言語のフロン トエンドをユーザが実装し,利用することも可能 • Dockerfileは今後「方言」に分かれていくかも知れない • docker/dockerfile:1.0 が「標準語」 1行目に書く # syntax = …
  • 16. 16 Copyright©2018 NTT Corp. All Rights Reserved. • クライアント側で export DOCKER_BUILDKIT=1 して docker build を実 行するとBuildKitが有効になる • あるいは, /etc/docker/daemon.json に {“features”:{“buildkit”:true}} と記 述しても有効化できる • Docker 18.06でも,デーモンをexperimentalモードで実行していれば BuildKitを有効化できる (Secretマウント,SSHマウントは利用不可) • BuildKitが有効になっていると docker build の出力が大きく変わる (次スライド) BuildKitの使い方
  • 17. 17 Copyright©2018 NTT Corp. All Rights Reserved. BuildKitの使い方 従来 BuildKitモード
  • 18. 18 Copyright©2018 NTT Corp. All Rights Reserved. • Dockerソケットへのアクセスを許すことは,ホストのroot権限を与える ことと同じ • インターネットへ向けてTCPでlistenするなら,TLSの設定が必須 • でもTLSの設定は面倒・間違いやすい Dockerソケットの設定
  • 19. 19 Copyright©2018 NTT Corp. All Rights Reserved. Dockerソケットの設定 https://docs.docker.com/engine/security/https/ より引用 $ openssl genrsa -aes256 -out ca-key.pem 4096 Generating RSA private key, 4096 bit long modulus ................................................................................ ................................................................................ ............................++ ........++ e is 65537 (0x10001) Enter pass phrase for ca-key.pem: Verifying - Enter pass phrase for ca-key.pem: $ openssl req -new -x509 -days 365 -key ca-key.pem -sha256 out ca.pem Enter pass phrase for ca-key.pem: You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]: State or Province Name (full name) [Some-State]:Queensland Locality Name (eg, city) []:Brisbane Organization Name (eg, company) [Internet Widgits Pty Ltd]:Docker Inc Organizational Unit Name (eg, section) []:Sales Common Name (e.g. server FQDN or YOUR name) []:$HOST Email Address []:Sven@home.org.au $ openssl genrsa -out server-key.pem 4096 Generating RSA private key, 4096 bit long modulus ............................. ........................................++ .................................... .............................................................++ e is 65537 (0x10001) $ openssl req -subj "/CN=$HOST" -sha256 -new -key server-key.pem -out server.csr $ echo subjectAltName = DNS:$HOST,IP:10.10.10.20,IP:127.0.0.1 >> extfile.cnf $ echo extendedKeyUsage = serverAuth >> extfile.cnf $ openssl x509 -req -days 365 -sha256 -in server.csr -CA ca.pem -CAkey ca- key.pem -CAcreateserial -out server-cert.pem -extfile extfile.cnf Signature ok subject=/CN=your.host.com Getting CA Private Key Enter pass phrase for ca-key.pem: $ openssl genrsa -out key.pem 4096 Generating RSA private key, 4096 bit long modulus .........................................................++ ................++ e is 65537 (0x10001) $ openssl req -subj '/CN=client' -new -key key.pem -out client.csr $ echo extendedKeyUsage = clientAuth >> extfile.cnf $ openssl x509 -req -days 365 -sha256 -in client.csr -CA ca.pem -CAkey ca- key.pem -CAcreateserial -out cert.pem -extfile extfile.cnf Signature ok subject=/CN=client Getting CA Private Key Enter pass phrase for ca-key.pem: $ rm -v client.csr server.csr $ chmod -v 0400 ca-key.pem key.pem server-key.pem $ chmod -v 0444 ca.pem server-cert.pem cert.pem $ dockerd --tlsverify --tlscacert=ca.pem --tlscert=server-cert.pem -- tlskey=server-key.pem -H=0.0.0.0:2376 $ docker --tlsverify --tlscacert=ca.pem --tlscert=cert.pem --tlskey=key.pem - H=$HOST:2376 version
  • 20. 20 Copyright©2018 NTT Corp. All Rights Reserved. Dockerソケットの設定 https://docs.docker.com/engine/security/https/ より引用 $ openssl genrsa -aes256 -out ca-key.pem 4096 Generating RSA private key, 4096 bit long modulus ................................................................................ ................................................................................ ............................++ ........++ e is 65537 (0x10001) Enter pass phrase for ca-key.pem: Verifying - Enter pass phrase for ca-key.pem: $ openssl req -new -x509 -days 365 -key ca-key.pem -sha256 out ca.pem Enter pass phrase for ca-key.pem: You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]: State or Province Name (full name) [Some-State]:Queensland Locality Name (eg, city) []:Brisbane Organization Name (eg, company) [Internet Widgits Pty Ltd]:Docker Inc Organizational Unit Name (eg, section) []:Sales Common Name (e.g. server FQDN or YOUR name) []:$HOST Email Address []:Sven@home.org.au $ openssl genrsa -out server-key.pem 4096 Generating RSA private key, 4096 bit long modulus ............................. ........................................++ .................................... .............................................................++ e is 65537 (0x10001) $ openssl req -subj "/CN=$HOST" -sha256 -new -key server-key.pem -out server.csr $ echo subjectAltName = DNS:$HOST,IP:10.10.10.20,IP:127.0.0.1 >> extfile.cnf $ echo extendedKeyUsage = serverAuth >> extfile.cnf $ openssl x509 -req -days 365 -sha256 -in server.csr -CA ca.pem -CAkey ca- key.pem -CAcreateserial -out server-cert.pem -extfile extfile.cnf Signature ok subject=/CN=your.host.com Getting CA Private Key Enter pass phrase for ca-key.pem: $ openssl genrsa -out key.pem 4096 Generating RSA private key, 4096 bit long modulus .........................................................++ ................++ e is 65537 (0x10001) $ openssl req -subj '/CN=client' -new -key key.pem -out client.csr $ echo extendedKeyUsage = clientAuth >> extfile.cnf $ openssl x509 -req -days 365 -sha256 -in client.csr -CA ca.pem -CAkey ca- key.pem -CAcreateserial -out cert.pem -extfile extfile.cnf Signature ok subject=/CN=client Getting CA Private Key Enter pass phrase for ca-key.pem: $ rm -v client.csr server.csr $ chmod -v 0400 ca-key.pem key.pem server-key.pem $ chmod -v 0444 ca.pem server-cert.pem cert.pem $ dockerd --tlsverify --tlscacert=ca.pem --tlscert=server-cert.pem -- tlskey=server-key.pem -H=0.0.0.0:2376 $ docker --tlsverify --tlscacert=ca.pem --tlscert=cert.pem --tlskey=key.pem - H=$HOST:2376 version
  • 21. 21 Copyright©2018 NTT Corp. All Rights Reserved. Dockerソケットの設定 https://blog.trendmicro.co.jp/archives/19773 より引用
  • 22. 22 Copyright©2018 NTT Corp. All Rights Reserved. • Docker 18.09では,`export DOCKER_HOST=ssh://ユーザ@ホスト`す るとTLSの代わりにSSHを用いてリモートDockerホストに接続できる • SSHはホストにDockerをインストールする前に何れにせよ設定するだろ うから,TLSと違って追加の手間が発生しない • 単に `ssh -l ユーザ ホスト – docker` コマンドを実行する場合と異な り,クライアントの ~/.docker/config.json に保存されているレジスト リ認証情報や,ビルドコンテキストにアクセスすることが可能 リモートDockerホストへのSSH接続
  • 23. 23 Copyright©2018 NTT Corp. All Rights Reserved. • devicemapper 及び overlay ストレージドライバが非推奨になった • aufs も19.03から非推奨 • overlay2 が推奨 • json-file に代わるログドライバとしてlocalが導入された • Protocol Buffersを使うのでオーバヘッドが小さい • RPM・DEBパッケージ構成が変わった • docker-ce から docker-ce-cli と containerd.io が分離した • クライアントだけ欲しい場合は docker-ce-cli だけインストールすれば良い • Windows Subsystem for Linux ユーザなどに有用かも知れない • Ubuntu 14.04, Debian 8がサポート外となった その他の変更点
  • 24. 24 Copyright©2018 NTT Corp. All Rights Reserved. • RUN –-mount=type=(cache|secret|ssh) の正式採用 • 非rootユーザでのDockerデーモンの実行 (#38050) • User Namespaceを用いる • --userns-remap と異なり,コンテナだけではなくDockerデーモンも非rootで実行 • Docker, containerd, runcが抱えうる脆弱性を軽減 • 今すぐ試したいなら https://github.com/rootless-containers/usernetes からバ イナリを入手できる (DockerだけでなくKubernetesも) • containerdとの重複コードの除去,軽量化 (#38043) • Dockerのストレージドライバをcontainerdの実装で置き換える Docker 19.03・19.09 予想
  • 25. 25 Copyright©2018 NTT Corp. All Rights Reserved. •BuildKitの正式採用 • 並列ビルド • コンテキストの差分転送 • キャッシュマウント • Secretマウント • SSHマウント •リモートDockerホストへのSSH接続 Docker 18.09の新機能 まとめ