Opensourcetechブログ

OpensourcetechによるNGINX/Zabbix/Neo4j/Linuxなどオープンソース技術に関するブログです。

Ubuntu Server 20.04 LTSのdockerコンテナ環境について

 

こんにちは、LinuCエバンジェリストこと、鯨井貴博@opensourcetechです。

 

 Ubuntu 20.04 LTSを使い始めたので、そのdockerコンテナ環境に関するメモです。

 

インストール完了後、SSHでログインすると以下のようにシステムステータスを表示してくれます。

※これいいですね。

f:id:opensourcetech:20200524222316p:plain

 

なお、インストール時にはSnapというパッケージ管理でコンテナ関連(microk8s/kata-containers/docker/etcd/heroku/juju/prometheusなど)をインストールしています。

f:id:opensourcetech:20200524222337p:plain



docker image ls & docker container ls。

コンテナイメージとコンテナがいますね。

f:id:opensourcetech:20200526071538p:plain

 

なお、以下の記事で書いてますが、

docker image ls = docker images

docker container ls = docker ps   となります。

docker 1.13におけるCLIコマンドの再構築について - Opensourcetechブログ

 

 

 

パッケージ管理

余談ですが、Ubuntu 20.04 LTSではsnapというパッケージ管理が使われています。

f:id:opensourcetech:20200526072107p:plain


マニュアルは、以下にあります。

Ubuntu Manpage: snap - Tool to interact with snaps



詳細は割愛しますが、 レポジトリーのことを「channel」と呼び、snap ****というコマンドでパッケージを管理します。

root@ubuntu2004server:~# snap services
Service Startup Current Notes
docker.dockerd enabled active -
lxd.activate enabled inactive -
lxd.daemon enabled inactive socket-activated
microk8s.daemon-apiserver enabled active -
microk8s.daemon-apiserver-kicker enabled active -
microk8s.daemon-cluster-agent enabled active -
microk8s.daemon-containerd enabled active -
microk8s.daemon-controller-manager enabled active -
microk8s.daemon-etcd enabled active -
microk8s.daemon-flanneld enabled active -
microk8s.daemon-kubelet enabled active -
microk8s.daemon-proxy enabled active -
microk8s.daemon-scheduler enabled active -
prometheus.prometheus enabled inactive -
root@ubuntu2004server:~# snap --version
snap 2.44.3+20.04
snapd 2.44.3+20.04
series 16
ubuntu 20.04
kernel 5.4.0-29-generic
root@ubuntu2004server:~# snap changes
ID Status Spawn Ready Summary
12 Done today at 17:54 UTC today at 17:55 UTC Auto-refresh snap "lxd"

root@ubuntu2004server:~# snap search docker
Name Version Publisher Notes Summary
docker 18.09.9 canonical? - Docker container runtime
kata-containers 1.11.0 katacontainers? classic Lightweight virtual machines that seamlessly plug into the containers ecosystem
etcd 3.2.10 canonical? - Resilient key-value store by CoreOS
convos 4.6.0 jhthorsen - Multiuser chat application that runs in your web browser
stubb 0.3.1 circleci? - A Docker utility by CircleCI.
img 0.5.7 bashfulrobot - Unprivileged Dockerfile & OCI compatible container img builder.
tabular 1.15 sil - Parse ASCII tabular data, such as the output from docker ps or netstat -tanp.
deepkit 2020.1.5 deepkit - The collaborative and analytical training suite for insightful, fast, and reproducible modern machine learning.
commandeer 1.0.0 fsproru-commandeer - Commandeer - View You Data, Manage Your Infrastructure as Code, Test Your Plumbing all from the convenience of a desktop app.
paradrop-agent 0.13.2 pd - Paradrop agent for managing an edge computing node
hostctl 1.0.10 gustavoandresmarin - manage your hosts file like a pro
monexec v0.1.14-dirty reddec - Light supervisor with optional Consul autoregistration
sqlitr 0.1.23 neilotoole - sqlitr is a trivial query tool for SQLite. It was created as a demonstration for neilotoole/xcgo.
traefik-nacc 1.0.1 nacc - Trafik, a modern reverse proxy
j2 0.3.1-0 cmars - Command-line interface to Jinja2 for templating in shell scripts.
docker-ls 0.3.2 pjdc - a browser for Docker registries
docker-credential-pass v0.6.0 mvc-aaa - Keep Docker credentials safe.
dry 0.9-beta.5 monch0 - A Docker manager for the terminal
kompose 1.18.0 ric2b - A conversion tool to go from Docker Compose to Kubernetes https://kompose.io
swarm-api 0.0.5 syntaqx - A dead simple rest api for docker swarm
dunner 2.1.3 agentmilindu - A Docker based task runner tool
fdrsrv v1.0.3 jc-lab - fudge docker registry server
kube-proxy-eks 1.10.3 canonical-cloud-snaps classic Kubernetes network proxy runs on each node.
easeml 0+git.45c580f-dirty easeml - Ease.ml is a declarative machine learning service platform.
procs v0.10.0 dalance - A modern replacement for ps written in Rust
testssl 3.0snap1 kyrofa - Testing TLS/SSL encryption anywhere on any port
hello-william 2.11 dockerpdyayy - GNU Hello, the "hello world" snap
hello-moose 2.10 dockerpdyayy - GNU Hello, the "hello world" snap

 



Ubuntu 20.04 LTSのdockerコンテナ環境

snapでインストールされているdockerの情報を見てみます。

latest/stableというチャンネルから18.09.9がインストールされていることが、読み取れます。

root@ubuntu2004server:~# snap info docker
name: docker
summary: Docker container runtime
publisher: Canonical?
store-url: https://snapcraft.io/docker
contact: snappy-devel@lists.ubuntu.com
license: (MIT AND Apache-2.0 AND GPL-2.0)
description: |
Build and run container images with Docker.

This build requires all files that Docker uses, such as dockerfiles, to be in $HOME. Keep files
there for 'docker build', 'docker save' and 'docker load'.

This snap is built by Canonical based on source code published by Docker, Inc. It is not endorsed
or published by Docker, Inc.

Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United
States and/or other countries. Docker, Inc. and other parties may also have trademark rights in
other terms used herein.
commands:
- docker.compose
- docker
- docker.help
- docker.machine
services:
docker.dockerd: simple, enabled, active
snap-id: sLCsFAO8PKM5Z0fAKNszUOX0YASjQfeZ
tracking: latest/stable
refresh-date: 9 days ago, at 11:02 UTC
channels:
latest/stable: 18.09.9 2019-11-18 (423) 126MB -
latest/candidate: 19.03.8 2020-05-20 (443) 134MB -
latest/beta: 19.03.8 2020-05-09 (443) 134MB -
latest/edge: 19.03.8 2020-05-08 (443) 134MB -
17.09/stable: ?
17.09/candidate: 17.09.1-ce 2017-12-22 (232) 44MB -
17.09/beta: 17.09.1-ce 2017-12-20 (232) 44MB -
17.09/edge: 17.09.1-ce 2017-12-14 (232) 44MB -
17.06/stable: 17.06.2-ce 2017-12-22 (179) 43MB -
17.06/candidate: 17.06.2-ce 2017-10-10 (179) 43MB -
17.06/beta: ↑
17.06/edge: 17.06.2-ce-1 2018-01-03 (237) 44MB -
17.03/stable: 17.03.2-ce-1 2017-07-20 (159) 42MB -
17.03/candidate: 17.03.2-ce-1 2017-06-30 (159) 42MB -
17.03/beta: ↑
17.03/edge: 17.03.2-ce-1 2017-06-30 (159) 42MB -
installed: 18.09.9 (423) 126MB -

 

 ローカル保有するコンテナイメージについては、コンテナID(識別子)で検索すると格納されているパスが確認できます。

root@ubuntu2004server:~# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 9beeba249f3e 10 days ago 127MB
zabbix/zabbix-appliance latest 663a9b177b54 3 months ago 383MB
root@ubuntu2004server:~# find / -name 9beeba249f3e*
/var/snap/docker/common/var-lib-docker/image/overlay2/imagedb/content/sha256/9beeba249f3ee158d3e495a6ac25c5667ae2de8a43ac2a8bfd2bf687a58c06c9
root@ubuntu2004server:~# find / -name 663a9b177b54*
/var/snap/docker/common/var-lib-docker/image/overlay2/imagedb/content/sha256/663a9b177b5407a259616c294a157d59f55db00f300f5e97fa6eb2a623c5adf0

 

 稼働中のコンテナについても、同様にコンテナID(識別子)から確認ができます。

root@ubuntu2004server:~# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8c2702b1706e nginx:latest "nginx -g 'daemon of…" 9 days ago Up 8 days 0.0.0.0:10080->80/tcp ecstatic_noyce
c134e490665b zabbix/zabbix-appliance:latest "/sbin/tini -- /usr/…" 9 days ago Up 8 days 0.0.0.0:80->80/tcp, 0.0.0.0:10051->10051/tcp, 443/tcp zabbix-appliance
root@ubuntu2004server:~# find / -name 8c2702b1706e*
/sys/fs/cgroup/pids/docker/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d
/sys/fs/cgroup/perf_event/docker/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d
/sys/fs/cgroup/cpuset/docker/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d
/sys/fs/cgroup/memory/docker/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d
/sys/fs/cgroup/freezer/docker/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d
/sys/fs/cgroup/devices/docker/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d
/sys/fs/cgroup/net_cls,net_prio/docker/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d
/sys/fs/cgroup/hugetlb/docker/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d
/sys/fs/cgroup/cpu,cpuacct/docker/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d
/sys/fs/cgroup/systemd/docker/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d
/var/snap/docker/common/var-lib-docker/image/overlay2/layerdb/mounts/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d
/var/snap/docker/common/var-lib-docker/containerd/daemon/io.containerd.runtime.v1.linux/moby/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d
/var/snap/docker/common/var-lib-docker/containers/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d
/var/snap/docker/common/var-lib-docker/containers/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d-json.log
/var/snap/docker/423/run/docker/runtime-runc/moby/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d
/var/snap/docker/423/run/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d
/var/snap/docker/423/run/docker/containerd/8c2702b1706ed54ec349b9bb5630dd8ab9d36d56297780657c7096c6bb812b2d

 

 

アフィリエイトのアクセストレード

 

 

 

 

 

 

www.slideshare.net

github.com

www.facebook.com

twitter.com

www.instagram.com

 

 

にほんブログ村 IT技術ブログ Linuxへ
Linux

にほんブログ村 IT技術ブログ オープンソースへ
オープンソース

 

 

Opensourcetech by Takahiro Kujirai