docker官方给出了一键安装脚本:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh ./get-docker.sh
安装过程中若出现GPG报错,报错信息如下:
# Executing docker install script, commit: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ sh -c apt-get update -qq >/dev/null
W: GPG error: http://repo.aptly.info nightly InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY XXXXXXXXXXXXXXXX
E: The repository 'http://repo.aptly.info nightly InRelease' is not signed.
可以使用一下方式添加GPG凭证
apt-key adv --keyserver pgp.mit.edu --recv-keys XXXXXXXXXXXXXXXX
其中XXXXXXXXXXXXXXXX就是上面报错中的NO_PUBKEY。
安装完成后可使用docker version查看docker版本属性