LPICの勉強兼ねる
必要なもの入れる
sudo apt update -y
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
Dockerのパッケージリポジトリ登録する
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
curl -fsSL
-f, --fail Fail silently (no output at all) on HTTP errors
-s, --silent Silent mode
-S, --show-error Show error even when -s is used
-L, --location Follow redirects
-
apt-key
-
GPG: GNU Privacy Guard
- パッケージの信頼性を確認するための署名のしくみ
- GPG鍵を
/etc/apt/trusted.gpg.d
に格納・管理する
-
lsb_release -cs
はbionic
とかを返す
-c, --codename show code name of this distribution
-s, --short show requested information in short format
- 実行結果
/etc/apt/sources.list
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu artful-security multiverse
+ deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
+ # deb-src [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
- パッケージデータベースを再度更新
sudo apt update -y
Docker CEインストール
sudo apt install -y docker-ce
- 最新の安定バージョン入る
apt list docker
docker --version
一覧表示... 完了
docker/bionic 1.5-1build1 amd64
Docker version 18.09.2, build 6247962
- systemdでDaemon化されているので次回OS起動時からは自動で実行される
systemctl is-enabled docker
enabled
ユーザーをdockerグループに入れる
sudo usermod -aG $(whoami) docker
- dockerのreloadやrestartでは駄目だった
sudo systemctl start reboot.target
動作確認
docker container run --rm -it alpine sh
- OK!
/ #