Ubuntu 18.04: コンテナ技術のDockerをインストールする


Table of Contents

1 Dockerをインストールする

docker-ceのリポジトリ追加に必要なパッケージをインストールします。

$ sudo apt install -y apt-transport-https ca-certificates curl software-properties-common

docker-ceのリポジトリを追加します。2018/05/14現在、bionic用のバイナリは用意されていないのでartful用のバイナリを利用します。

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -$ V=artful #V=$(lsb_release -cs)$ sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu ${V} stable”$ sudo apt update -y

docker-ceをインストールします。

$ sudo apt install -y docker-ce

ユーザをdockerグループに追加します。dockerグループに所属したユーザはdockerコマンドをsudoなしで実行できるようになります。

$ sudo gpasswd -a “${USER}” docker$ sudo reboot

2 動作確認

hello-worldを実行します。

$ docker run hello-world<snip>Hello from Docker!<snip>

Android | Linux | SDL - Narrow Escape