Linux Mint を使っていた時にも Docker Engine をインストールしたことがあったのですが、久しぶりに Docker で試したいことが出てきたので LMDE に Docker CE をインストールしてみました。
一応、LMDE の標準リポジトリにも Docker は用意されているのですが、docker.io というだいぶ古いパッケージです。バージョンは 20.10.24 です。
まあ、このバージョンでもいいのですが、せっかくなので新しいバージョンをインストールしてみることにしました。
インストール手順は Docker 公式サイトのこちらのガイドを参考にしました。
Install Docker Engine on Debian
まずは apt リポジトリの追加です。
$ apt install ca-certificates curl パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています... 完了 状態情報を読み取っています... 完了 ca-certificates はすでに最新バージョン (20230311) です。 curl はすでに最新バージョン (8.7.1-5) です。 アップグレード: 0 個、新規インストール: 0 個、削除: 0 個、保留: 0 個。
ca-certificates と curl はすでにインストール済みでした。
$ sudo install -m 0755 -d /etc/apt/keyrings $ sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc $ sudo chmod a+r /etc/apt/keyrings/docker.asc
キーファイルのダウンロードも無事に終了です。
$ echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt リポジトリに URL を追加しています。エラーなく終了しました。
さあ、apt のリポジトリ情報を更新してみましょう。
$ apt update 無視:1 http://ftp.jaist.ac.jp/pub/Linux/linuxmint/packages faye InRelease ヒット:2 http://ftp.riken.jp/Linux/debian/debian bookworm InRelease ヒット:3 http://ftp.riken.jp/Linux/debian/debian bookworm-updates InRelease ヒット:4 http://ftp.jaist.ac.jp/pub/Linux/linuxmint/packages faye Release ヒット:6 http://security.debian.org bookworm-security InRelease ヒット:7 http://ftp.riken.jp/Linux/debian/debian bookworm-backports InRelease 無視:8 https://download.docker.com/linux/debian faye InRelease ヒット:9 http://ftp.riken.jp/Linux/debian/debian testing InRelease エラー:10 https://download.docker.com/linux/debian faye Release 404 Not Found [IP: 2600:9000:21c5:4e00:3:db06:4200:93a1 443] パッケージリストを読み込んでいます... 完了 E: リポジトリ https://download.docker.com/linux/debian faye Release には Release ファイルがありません。 N: このようなリポジトリから更新を安全に行うことができないので、デフォルトでは更新が無効になっています。 N: リポジトリの作成とユーザ設定の詳細は、apt-secure(8) man ページを参照してください。
おや?エラーになってますね。
download.docker.com/linux/debian faye Relase の「faye」が「bookworm」にならないとダメですね。
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ $(. /etc/os-release && echo "bookworm") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
VERSION_CODENAME で持ってきている部分を変数ではなく直接「bookworm」と書き換えて再実行しました。
$ apt update 無視:1 http://ftp.jaist.ac.jp/pub/Linux/linuxmint/packages faye InRelease 取得:2 https://download.docker.com/linux/debian bookworm InRelease [43.3 kB] ヒット:3 http://ftp.riken.jp/Linux/debian/debian bookworm InRelease ヒット:4 http://ftp.riken.jp/Linux/debian/debian bookworm-updates InRelease ヒット:5 http://ftp.jaist.ac.jp/pub/Linux/linuxmint/packages faye Release ヒット:6 http://security.debian.org bookworm-security InRelease ヒット:7 http://ftp.riken.jp/Linux/debian/debian bookworm-backports InRelease ヒット:8 http://ftp.riken.jp/Linux/debian/debian testing InRelease 取得:9 https://download.docker.com/linux/debian bookworm/stable amd64 Packages [23.4 kB] 取得:10 https://download.docker.com/linux/debian bookworm/stable amd64 Contents (deb) [1,340 B] 68.1 kB を 1秒 で取得しました (92.4 kB/s) パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています... 完了 状態情報を読み取っています... 完了 パッケージはすべて最新です。
今度は正常に終了しました。さあ、ようやく Docker のインストールです。
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています... 完了 状態情報を読み取っています... 完了 以下の追加パッケージがインストールされます: docker-ce-rootless-extras git git-man liberror-perl libslirp0 pigz slirp4netns 提案パッケージ: aufs-tools cgroupfs-mount | cgroup-lite git-daemon-run | git-daemon-sysvinit git-doc git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn 以下のパッケージが新たにインストールされます: containerd.io docker-buildx-plugin docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose-plugin git git-man liberror-perl libslirp0 pigz slirp4netns アップグレード: 0 個、新規インストール: 12 個、削除: 0 個、保留: 0 個。 131 MB のアーカイブを取得する必要があります。 この操作後に追加で 482 MB のディスク容量が消費されます。 続行しますか? [Y/n]
おお、インストールできますね。
インストールが完了したら検証です。
$ sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world c1ec31eb5944: Pull complete Digest: sha256:266b191e926f65542fa8daaec01a192c4d292bff79426f47300a046e1bc576fd Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
Unable to find 〜 と表示されてビックリしましたが「そっか、勝手にダウンロードして実行してくれるんだっけか」と Docker の動きを思い出して少し待つと Hello メッセージが無事に表示されました。
$ docker --version Docker version 26.1.3, build b72abbb
ついでに Docker のバージョンも確認してみました。これにて終了です。