🐳
WSL2:AlmaLinux 8.5にdockerを用意した時の記録
dockerって何?美味いの?((((;゚Д゚))))ガクガクブルブル
日進月歩ですな、コンテナの知識や理解がないと若者ら失笑されそうなんでとりあえず触っておこっと。
手順
WSL2:AlmaLinux起動
リポジトリ追加
- デフォでは、そのままdnfっても駄目だそうで、dockerのリポジトリが必要
$ sudo dnf config-manager \
add-repo> --add-repo \
> https://download.docker.com/linux/centos/docker-ce.repo
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
Dockerのインストール
- 以下3つのパッケージをインスコ
- docker-ce:デーモン本体
- docker-ce-cli:操作するためのコマンド達
- containerd.io:ランタイム(プログラムとかを動かす時に必要な部品)
$ sudo dnf -y install docker-ce docker-ce-cli containerd.io
AlmaLinux 8 - BaseOS 7.3 MB/s | 7.0 MB 00:00
AlmaLinux 8 - AppStream 4.5 MB/s | 9.8 MB 00:02
AlmaLinux 8 - Extras 15 kB/s | 12 kB 00:00
Docker CE Stable - x86_64 221 kB/s | 23 kB 00:00
Dependencies resolved.
=============================================================================================================================================== Package Architecture Version Repository Size
===============================================================================================================================================Installing:
containerd.io x86_64 1.5.11-3.1.el8 docker-ce-stable 29 M
docker-ce x86_64 3:20.10.14-3.el8 docker-ce-stable 22 M
docker-ce-cli x86_64 1:20.10.14-3.el8 docker-ce-stable 30 M
Installing dependencies:
checkpolicy x86_64 2.9-1.el8 baseos 347 k
container-selinux noarch 2:2.173.0-1.module_el8.5.0+2613+1b78b731 appstream 56 k
docker-ce-rootless-extras x86_64 20.10.14-3.el8 docker-ce-stable 4.6 M
docker-scan-plugin x86_64 0.17.0-3.el8 docker-ce-stable 3.8 M
fuse-common x86_64 3.2.1-12.el8 baseos 21 k
fuse-overlayfs x86_64 1.8-1.module_el8.5.0+2613+1b78b731 appstream 72 k
fuse3 x86_64 3.2.1-12.el8 baseos 50 k
fuse3-libs x86_64 3.2.1-12.el8 baseos 94 k
iptables x86_64 1.8.4-20.el8 baseos 583 k
kmod x86_64 25-18.el8 baseos 125 k
libcgroup x86_64 0.41-19.el8 baseos 69 k
libmnl x86_64 1.0.4-6.el8 baseos 30 k
libnetfilter_conntrack x86_64 1.0.6-5.el8 baseos 65 k
libnfnetlink x86_64 1.0.1-13.el8 baseos 33 k
libnftnl x86_64 1.1.5-4.el8 baseos 83 k
libselinux-utils x86_64 2.9-5.el8 baseos 242 k
libslirp x86_64 4.4.0-1.module_el8.5.0+2613+1b78b731 appstream 69 k
policycoreutils x86_64 2.9-16.el8 baseos 372 k
policycoreutils-python-utils noarch 2.9-16.el8 baseos 251 k
python3-audit x86_64 3.0-0.17.20191104git1c2f876.el8 baseos 86 k
python3-libselinux x86_64 2.9-5.el8 baseos 282 k
python3-libsemanage x86_64 2.9-6.el8 baseos 126 k
python3-policycoreutils noarch 2.9-16.el8 baseos 2.2 M
python3-setools x86_64 4.3.0-2.el8 baseos 625 k
rpm-plugin-selinux x86_64 4.14.3-19.el8 baseos 76 k
selinux-policy noarch 3.14.3-80.el8_5.2 baseos 635 k
selinux-policy-targeted noarch 3.14.3-80.el8_5.2 baseos 15 M
slirp4netns x86_64 1.1.8-1.module_el8.5.0+2613+1b78b731 appstream 50 k
Enabling module streams:
container-tools rhel8
Transaction Summary
===============================================================================================================================================Install 31 Packages
Total download size: 111 M
Installed size: 439 M
Downloading Packages:
AlmaLinux 8 - BaseOS 195% [============================================================================================(1/31): fuse-common-3.2.1-12.el8.x86_64.rpm 752 kB/s | 21 kB 00:00
(2/31): checkpolicy-2.9-1.el8.x86_64.rpm 6.5 MB/s | 347 kB 00:00
(3/31): fuse3-libs-3.2.1-12.el8.x86_64.rpm 3.1 MB/s | 94 kB 00:00
(4/31): fuse3-3.2.1-12.el8.x86_64.rpm 817 kB/s | 50 kB 00:00
(5/31): iptables-1.8.4-20.el8.x86_64.rpm 20 MB/s | 583 kB 00:00
(6/31): kmod-25-18.el8.x86_64.rpm 4.7 MB/s | 125 kB 00:00
(7/31): libmnl-1.0.4-6.el8.x86_64.rpm 2.9 MB/s | 30 kB 00:00
(8/31): libcgroup-0.41-19.el8.x86_64.rpm 1.8 MB/s | 69 kB 00:00
(9/31): libnetfilter_conntrack-1.0.6-5.el8.x86_64.rpm 2.9 MB/s | 65 kB 00:00
(10/31): libnfnetlink-1.0.1-13.el8.x86_64.rpm 1.2 MB/s | 33 kB 00:00
(11/31): libselinux-utils-2.9-5.el8.x86_64.rpm 16 MB/s | 242 kB 00:00
(12/31): libnftnl-1.1.5-4.el8.x86_64.rpm 3.2 MB/s | 83 kB 00:00
(13/31): policycoreutils-python-utils-2.9-16.el8.noarch.rpm 16 MB/s | 251 kB 00:00
(14/31): python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64.rpm 6.3 MB/s | 86 kB 00:00
(15/31): policycoreutils-2.9-16.el8.x86_64.rpm 11 MB/s | 372 kB 00:00
(16/31): python3-libsemanage-2.9-6.el8.x86_64.rpm 9.0 MB/s | 126 kB 00:00
(17/31): python3-libselinux-2.9-5.el8.x86_64.rpm 12 MB/s | 282 kB 00:00
(18/31): python3-setools-4.3.0-2.el8.x86_64.rpm 19 MB/s | 625 kB 00:00
(19/31): rpm-plugin-selinux-4.14.3-19.el8.x86_64.rpm 2.6 MB/s | 76 kB 00:00
(20/31): selinux-policy-3.14.3-80.el8_5.2.noarch.rpm 14 MB/s | 635 kB 00:00
(21/31): container-selinux-2.173.0-1.module_el8.5.0+2613+1b78b731.noarch.rpm 3.6 MB/s | 56 kB 00:00
(22/31): python3-policycoreutils-2.9-16.el8.noarch.rpm 20 MB/s | 2.2 MB 00:00
(23/31): fuse-overlayfs-1.8-1.module_el8.5.0+2613+1b78b731.x86_64.rpm 4.0 MB/s | 72 kB 00:00
(24/31): libslirp-4.4.0-1.module_el8.5.0+2613+1b78b731.x86_64.rpm 6.0 MB/s | 69 kB 00:00
(25/31): slirp4netns-1.1.8-1.module_el8.5.0+2613+1b78b731.x86_64.rpm 3.6 MB/s | 50 kB 00:00
(26/31): docker-ce-20.10.14-3.el8.x86_64.rpm 16 MB/s | 22 MB 00:01
(27/31): containerd.io-1.5.11-3.1.el8.x86_64.rpm 20 MB/s | 29 MB 00:01
(28/31): docker-ce-rootless-extras-20.10.14-3.el8.x86_64.rpm 24 MB/s | 4.6 MB 00:00
(29/31): docker-scan-plugin-0.17.0-3.el8.x86_64.rpm 19 MB/s | 3.8 MB 00:00
(30/31): selinux-policy-targeted-3.14.3-80.el8_5.2.noarch.rpm 7.2 MB/s | 15 MB 00:02
(31/31): docker-ce-cli-20.10.14-3.el8.x86_64.rpm 31 MB/s | 30 MB 00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 28 MB/s | 111 MB 00:04
Docker CE Stable - x86_64 58 kB/s | 1.6 kB 00:00
Importing GPG key 0x621E9F35:
Userid : "Docker Release (CE rpm) <docker@docker.com>"
Fingerprint: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
From : https://download.docker.com/linux/centos/gpg
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : python3-libselinux-2.9-5.el8.x86_64 1/31
Installing : libmnl-1.0.4-6.el8.x86_64 2/31
Running scriptlet: libmnl-1.0.4-6.el8.x86_64 2/31
/sbin/ldconfig: /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link
Installing : docker-scan-plugin-0.17.0-3.el8.x86_64 3/31
Running scriptlet: docker-scan-plugin-0.17.0-3.el8.x86_64 3/31
Installing : docker-ce-cli-1:20.10.14-3.el8.x86_64 4/31
Running scriptlet: docker-ce-cli-1:20.10.14-3.el8.x86_64 4/31
Installing : libselinux-utils-2.9-5.el8.x86_64 5/31
Installing : policycoreutils-2.9-16.el8.x86_64 6/31
Running scriptlet: policycoreutils-2.9-16.el8.x86_64 6/31
Installing : rpm-plugin-selinux-4.14.3-19.el8.x86_64 7/31
Installing : selinux-policy-3.14.3-80.el8_5.2.noarch 8/31
Running scriptlet: selinux-policy-3.14.3-80.el8_5.2.noarch 8/31
Running scriptlet: selinux-policy-targeted-3.14.3-80.el8_5.2.noarch 9/31
Installing : selinux-policy-targeted-3.14.3-80.el8_5.2.noarch 9/31
Running scriptlet: selinux-policy-targeted-3.14.3-80.el8_5.2.noarch 9/31
Installing : libnfnetlink-1.0.1-13.el8.x86_64 10/31
Running scriptlet: libnfnetlink-1.0.1-13.el8.x86_64 10/31
/sbin/ldconfig: /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link
Installing : libnetfilter_conntrack-1.0.6-5.el8.x86_64 11/31
Running scriptlet: libnetfilter_conntrack-1.0.6-5.el8.x86_64 11/31
/sbin/ldconfig: /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link
Installing : libnftnl-1.1.5-4.el8.x86_64 12/31
Running scriptlet: libnftnl-1.1.5-4.el8.x86_64 12/31
/sbin/ldconfig: /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link
Running scriptlet: iptables-1.8.4-20.el8.x86_64 13/31
Installing : iptables-1.8.4-20.el8.x86_64 13/31
Running scriptlet: iptables-1.8.4-20.el8.x86_64 13/31
/sbin/ldconfig: /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link
Installing : python3-libsemanage-2.9-6.el8.x86_64 14/31
Installing : python3-setools-4.3.0-2.el8.x86_64 15/31
Installing : libslirp-4.4.0-1.module_el8.5.0+2613+1b78b731.x86_64 16/31
Installing : slirp4netns-1.1.8-1.module_el8.5.0+2613+1b78b731.x86_64 17/31
Installing : python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64 18/31
Running scriptlet: libcgroup-0.41-19.el8.x86_64 19/31
Installing : libcgroup-0.41-19.el8.x86_64 19/31
Running scriptlet: libcgroup-0.41-19.el8.x86_64 19/31
/sbin/ldconfig: /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link
Installing : kmod-25-18.el8.x86_64 20/31
Installing : fuse3-libs-3.2.1-12.el8.x86_64 21/31
Running scriptlet: fuse3-libs-3.2.1-12.el8.x86_64 21/31
/sbin/ldconfig: /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link
Installing : fuse-common-3.2.1-12.el8.x86_64 22/31
Installing : fuse3-3.2.1-12.el8.x86_64 23/31
Installing : fuse-overlayfs-1.8-1.module_el8.5.0+2613+1b78b731.x86_64 24/31
Running scriptlet: fuse-overlayfs-1.8-1.module_el8.5.0+2613+1b78b731.x86_64 24/31
Installing : checkpolicy-2.9-1.el8.x86_64 25/31
Installing : python3-policycoreutils-2.9-16.el8.noarch 26/31
Installing : policycoreutils-python-utils-2.9-16.el8.noarch 27/31
Running scriptlet: container-selinux-2:2.173.0-1.module_el8.5.0+2613+1b78b731.noarch 28/31
Installing : container-selinux-2:2.173.0-1.module_el8.5.0+2613+1b78b731.noarch 28/31
Running scriptlet: container-selinux-2:2.173.0-1.module_el8.5.0+2613+1b78b731.noarch 28/31
Installing : containerd.io-1.5.11-3.1.el8.x86_64 29/31
Running scriptlet: containerd.io-1.5.11-3.1.el8.x86_64 29/31
Installing : docker-ce-rootless-extras-20.10.14-3.el8.x86_64 30/31
Running scriptlet: docker-ce-rootless-extras-20.10.14-3.el8.x86_64 30/31
Installing : docker-ce-3:20.10.14-3.el8.x86_64 31/31
Running scriptlet: docker-ce-3:20.10.14-3.el8.x86_64 31/31
Running scriptlet: container-selinux-2:2.173.0-1.module_el8.5.0+2613+1b78b731.noarch 31/31
Running scriptlet: docker-ce-3:20.10.14-3.el8.x86_64 31/31
/sbin/ldconfig: /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link
Verifying : checkpolicy-2.9-1.el8.x86_64 1/31
Verifying : fuse-common-3.2.1-12.el8.x86_64 2/31
Verifying : fuse3-3.2.1-12.el8.x86_64 3/31
Verifying : fuse3-libs-3.2.1-12.el8.x86_64 4/31
Verifying : iptables-1.8.4-20.el8.x86_64 5/31
Verifying : kmod-25-18.el8.x86_64 6/31
Verifying : libcgroup-0.41-19.el8.x86_64 7/31
Verifying : libmnl-1.0.4-6.el8.x86_64 8/31
Verifying : libnetfilter_conntrack-1.0.6-5.el8.x86_64 9/31
Verifying : libnfnetlink-1.0.1-13.el8.x86_64 10/31
Verifying : libnftnl-1.1.5-4.el8.x86_64 11/31
Verifying : libselinux-utils-2.9-5.el8.x86_64 12/31
Verifying : policycoreutils-2.9-16.el8.x86_64 13/31
Verifying : policycoreutils-python-utils-2.9-16.el8.noarch 14/31
Verifying : python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64 15/31
Verifying : python3-libselinux-2.9-5.el8.x86_64 16/31
Verifying : python3-libsemanage-2.9-6.el8.x86_64 17/31
Verifying : python3-policycoreutils-2.9-16.el8.noarch 18/31
Verifying : python3-setools-4.3.0-2.el8.x86_64 19/31
Verifying : rpm-plugin-selinux-4.14.3-19.el8.x86_64 20/31
Verifying : selinux-policy-3.14.3-80.el8_5.2.noarch 21/31
Verifying : selinux-policy-targeted-3.14.3-80.el8_5.2.noarch 22/31
Verifying : container-selinux-2:2.173.0-1.module_el8.5.0+2613+1b78b731.noarch 23/31
Verifying : fuse-overlayfs-1.8-1.module_el8.5.0+2613+1b78b731.x86_64 24/31
Verifying : libslirp-4.4.0-1.module_el8.5.0+2613+1b78b731.x86_64 25/31
Verifying : slirp4netns-1.1.8-1.module_el8.5.0+2613+1b78b731.x86_64 26/31
Verifying : containerd.io-1.5.11-3.1.el8.x86_64 27/31
Verifying : docker-ce-3:20.10.14-3.el8.x86_64 28/31
Verifying : docker-ce-cli-1:20.10.14-3.el8.x86_64 29/31
Verifying : docker-ce-rootless-extras-20.10.14-3.el8.x86_64 30/31
Verifying : docker-scan-plugin-0.17.0-3.el8.x86_64 31/31
Installed:
checkpolicy-2.9-1.el8.x86_64 container-selinux-2:2.173.0-1.module_el8.5.0+2613+1b78b731.noarch
containerd.io-1.5.11-3.1.el8.x86_64 docker-ce-3:20.10.14-3.el8.x86_64
docker-ce-cli-1:20.10.14-3.el8.x86_64 docker-ce-rootless-extras-20.10.14-3.el8.x86_64
docker-scan-plugin-0.17.0-3.el8.x86_64 fuse-common-3.2.1-12.el8.x86_64
fuse-overlayfs-1.8-1.module_el8.5.0+2613+1b78b731.x86_64 fuse3-3.2.1-12.el8.x86_64
fuse3-libs-3.2.1-12.el8.x86_64 iptables-1.8.4-20.el8.x86_64
kmod-25-18.el8.x86_64 libcgroup-0.41-19.el8.x86_64
libmnl-1.0.4-6.el8.x86_64 libnetfilter_conntrack-1.0.6-5.el8.x86_64
libnfnetlink-1.0.1-13.el8.x86_64 libnftnl-1.1.5-4.el8.x86_64
libselinux-utils-2.9-5.el8.x86_64 libslirp-4.4.0-1.module_el8.5.0+2613+1b78b731.x86_64
policycoreutils-2.9-16.el8.x86_64 policycoreutils-python-utils-2.9-16.el8.noarch
python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64 python3-libselinux-2.9-5.el8.x86_64
python3-libsemanage-2.9-6.el8.x86_64 python3-policycoreutils-2.9-16.el8.noarch
python3-setools-4.3.0-2.el8.x86_64 rpm-plugin-selinux-4.14.3-19.el8.x86_64
selinux-policy-3.14.3-80.el8_5.2.noarch selinux-policy-targeted-3.14.3-80.el8_5.2.noarch
slirp4netns-1.1.8-1.module_el8.5.0+2613+1b78b731.x86_64
Complete!
インストール完了確認
- dockerのバージョンがいくつか?確認しとこう
$ sudo docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.8.1-docker)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
- おや?エラーですな?docker daemonが起動していないようだ。
- いろいろググって調べた結果、WSL2でdocker使うには、Windows OS側で、Docker desktopをインストールしなさいということが判明
Docker desktopのインストール
- Docker公式にアクセス
- ダウンロードページからDocker Desktop for Windowsをゲット
- Docker Desktop Installer.exeをインストール
- Docker Desktop起動し、Settingsへ、
-
Generalにて、Use the WSL2 Base engineにチェックが付いてることを確認
-
Resources-WSL INTEGRATION にて、以下を確認
- Enable integation with my default WSL distroにチェックが付いてる
- AlmaLinux-8が有効になっている
-
Apply & Restartボタンをクリック
-
WSL2:AlmaLinuxに戻り再度インストール完了確認
$ sudo docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.8.2)
compose: Docker Compose (Docker Inc., v2.4.1)
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 1
Server Version: 20.10.14
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 3df54a852345ae127d1fa3092b95168e4a88e2f8
runc version: v1.0.3-0-gf46b6ba
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 5.10.16.3-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 12.31GiB
Name: docker-desktop
ID: EER4
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5000
127.0.0.0/8
Live Restore Enabled: false
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
- ブロック I/O ( blkio ) サブシステムに関する警告はとりあえずスキップ
自動起動on
$ sudo systemctl enable docker
- とりあえずこれで準備完了。
後記
数年前にCoreOSとかが話題になったときに、コンテナを少しだけ自宅のESXiにていじっておりましたが、もはや当たり前の時代に突入ですな。
dockerで何動かすか?目的もってやらんと続きませんな。
何動かそうかな?
Discussion