0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ChromeOSのLinuxにDockerをインストール(GPG鍵の問題を解決)

Posted at

ChromebookにDockerを入れるにはいくつか方法があり、(A) aptを使ったもっともオフィシャルなやり方、(B) GitHubでとあるユーザがシェアしたやりかた、(C) 公式のConvenience Script のどちらを実行しても、GPG keyのエラーが問題になり、7EA0A9C3F273FCD8 のpublic keyの問題があり、sudo apt-get update の部分で失敗していた。これを解決したので、途中の過程などを共有する。

TLDR: Docker GPG鍵の問題を解決する

# キーリングディレクトリが存在しない場合は作成
sudo install -m 0755 -d /etc/apt/keyrings

# DockerのGPG鍵を取得
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

# キーリングファイルのパーミッションを適切に設定
sudo chmod a+r /etc/apt/keyrings/docker.gpg


echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

このあとに sudo apt-get updateが成功すれば、あとは色々なやりかたでdockerをインストールできる。(A)にせよ(B)にせよ、以下のようにできる。

sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo docker run hello-world

エラーメッセージのケーススタディ

最初のsudo apt-get updateのところでスタックするのはあまり良いことではない。

(A) aptを使った最もオフィシャルなやりかた

ykanta@penguin:~$ sudo ./docker_install.sh 
Hit:1 https://deb.debian.org/debian bookworm InRelease
Hit:2 https://deb.debian.org/debian bookworm-updates InRelease               
Hit:3 https://deb.debian.org/debian-security bookworm-security InRelease     
Get:4 https://download.docker.com/linux/debian bookworm InRelease [46.6 kB]  
Ign:5 https://storage.googleapis.com/cros-packages/140 bookworm InRelease    
Hit:6 https://packages.cloud.google.com/apt cloud-sdk InRelease     
Hit:7 https://packages.microsoft.com/repos/code stable InRelease
Hit:8 https://storage.googleapis.com/cros-packages/140 bookworm Release
Err:4 https://download.docker.com/linux/debian bookworm InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
Reading package lists... Done
W: GPG error: https://download.docker.com/linux/debian bookworm InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
E: The repository 'https://download.docker.com/linux/debian bookworm InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

(B) Githubのとあるユーザが共有していたやりかた

GPG errorが出るので、このやりかたは途中でやめた。

ykanta@penguin:~$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"
Repository: 'deb [arch=amd64] https://download.docker.com/linux/debian bookworm stable'
Description:
Archive for codename: bookworm components: stable
More info: https://download.docker.com/linux/debian
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Adding deb entry to /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_debian-bookworm.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/archive_uri-https_download_docker_com_linux_debian-bookworm.list
Hit:1 https://deb.debian.org/debian bookworm InRelease
Get:2 https://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]     
Get:3 https://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 https://download.docker.com/linux/debian bookworm InRelease [46.6 kB]  
Get:5 https://packages.microsoft.com/repos/code stable InRelease [3,590 B]   
Hit:6 https://packages.cloud.google.com/apt cloud-sdk InRelease              
Ign:7 https://storage.googleapis.com/cros-packages/140 bookworm InRelease    
Hit:8 https://storage.googleapis.com/cros-packages/140 bookworm Release
Err:4 https://download.docker.com/linux/debian bookworm InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
Get:9 https://packages.microsoft.com/repos/code stable/main arm64 Packages [20.3 kB]
Reading package lists... Done      
W: GPG error: https://download.docker.com/linux/debian bookworm InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
E: The repository 'https://download.docker.com/linux/debian bookworm InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

(C) Convenience Scriptを試してみる

ykanta@penguin:~$ sudo sh get-docker.sh
# Executing docker install script, commit: 21ac930799ead7539270df8a220d0505ed0e660f
+ sh -c apt-get -qq update >/dev/null
W: GPG error: https://download.docker.com/linux/debian bookworm InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
E: The repository 'https://download.docker.com/linux/debian bookworm InRelease' is not signed.
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?