はじめに
前回の ZScaler 配下でnpm install ができなかったときの対応方法 という記事を書きました。
その後色々やっていたら、今度は Podman Desktop で同様の事象を引いたので、その解消手段を書いておきます。
ちなみにエラーメッセージはこんな感じです。 (CentOS を起動しようとした際のもの)
% podman run centos
Resolved "centos" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull quay.io/centos/centos:latest...
Error: internal error: unable to copy from source docker://quay.io/centos/centos:latest: initializing source docker://quay.io/centos/centos:latest: pinging container registry quay.io: Get "https://quay.io/v2/": tls: failed to verify certificate: x509: certificate signed by unknown authority
Podman Desktop のインストールや初期設定は、すでに色々書かれていると思いますが、自分はこちらを参考にさせていただきました。
Podman Desktopインストール手順<macOS向け>
解決までにやったこと
ということで本題です。
まず Podman の仮想マシンの名前を確認します。
podman machine list
NAME VM TYPE CREATED LAST UP CPUS MEMORY DISK SIZE
podman-machine-default applehv 27 minutes ago Currently running 7 3.725GiB 93GiB
通常であれば podman-machine-default
になっているようですね。
次に、この仮想マシン内に前回の記事 ZScaler 配下でnpm install ができなかったときの対応方法 で使用した ca-bundle.pem
をコピーします。
コピー先はどこでも良いのですが、一旦仮想マシン側のホームにしました。
podman machine cp /local-path/to/ca-bundle.pm podman-machine-default:~
次に Podman 仮想マシンに ssh します。
podman machine ssh
次の手順は本来不要なのですが、一度 /etc/pki/ca-trust/source
に移動して README を見てみます。
cd /etc/pki/ca-trust/source
cat README
This directory /etc/pki/ca-trust/source/ contains CA certificates and
trust settings in the PEM file format. The trust settings found here will be
interpreted with a high priority - higher than the ones found in
/usr/share/pki/ca-trust-source/.
=============================================================================
QUICK HELP: To add a certificate in the simple PEM or DER file formats to the
list of CAs trusted on the system:
Copy it to the
/etc/pki/ca-trust/source/anchors/
subdirectory, and run the
update-ca-trust
command.
If your certificate is in the extended BEGIN TRUSTED file format,
then place it into the main source/ directory instead.
=============================================================================
Please refer to the update-ca-trust(8) manual page for additional information.
こんな感じで説明を書いてくれているのですよね。
なので、それに従って以下を実施します。
cp ~/ca-bundle.pem
update-ca-trust
この状態で、一度「Podman 仮想マシン」の中から以下を実施してみます。
podman run ubuntu ls
設定に問題がなければ、これによりイメージのダウンロードが始まるはずです。
ここまでできれば、あとは MacBook 側からも同じことができるはずなのですが、一度 Podman Desktop の再起動が必要になるようです。
ということで今度は MacBook 側から。
動作確認という意味で、一度 Podman 仮想マシン側のイメージを全部削除して再度 PULL してみました。
% podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
% podman run ubuntu ls
Resolved "ubuntu" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull docker.io/library/ubuntu:latest...
Getting image source signatures
Copying blob sha256:2f074dc76c5da961ce13817b02fa1e3c3070ad4b94970aa7f52f6c0d63b07696
Copying config sha256:57c587f9225f37f619efa1b1f8b6ad63b39c9f46417c9660035607220ae9d33e
Writing manifest to image destination
bin
boot
dev
etc
home
lib
media
mnt
opt
proc
root
run
sbin
srv
sys
tmp
usr
var
以上です。