docker
とdocker-compose
をインストールします。
Ubuntu
環境
以下の環境で実行してます。
cat /etc/lsb-release && echo ------ && arch
# DISTRIB_ID=Ubuntu
# DISTRIB_RELEASE=18.04
# DISTRIB_CODENAME=bionic
# DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"
# ------
# x86_64
インストールコマンド
# Docker インストール
curl -fsSL get.docker.com | sh
# Docker Compose インストール
curl -L https://github.com/docker/compose/releases/download/`curl -fsS https://api.github.com/repos/docker/compose/releases | grep '"tag_name":' | xargs -n 2 | cut -d ' ' -f2 | sed 's/,//' | grep -v rc | head -n1`/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose \
&& chmod 755 /usr/local/bin/docker-compose
# dockerグループ編集
usermod -aG docker
# ubuntu@14.04 だとサービスが起動していなかったので必要かも?
service docker start
バージョン確認
そしてバージョンの確認や実行ができれば大丈夫です。
docker -v \
&& docker-compose -v \
&& docker run hello-world
# Docker version 19.03.1, build 74b1e89
# docker-compose version 1.24.1, build 4667896b
#
# Hello from Docker!
# This message shows that your installation appears to be working correctly.
#
# To generate this message, Docker took the following steps:
# 1. The Docker client contacted the Docker daemon.
# 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
# (amd64)
# 3. The Docker daemon created a new container from that image which runs the
# executable that produces the output you are currently reading.
# 4. The Docker daemon streamed that output to the Docker client, which sent it
# to your terminal.
#
# To try something more ambitious, you can run an Ubuntu container with:
# $ docker run -it ubuntu bash
#
# Share images, automate workflows, and more with a free Docker ID:
# https://hub.docker.com/
#
# For more examples and ideas, visit:
# https://docs.docker.com/get-started/