【HowTo】Docker Install 手順 on CentOS

1 min読了の目安(約800字TECH技術記事

Overview

  • DockerをcentOSにインストールする手順
  • CentOS7, 8 で動作確認済み

Install Docker via yum

yum update -y && yum upgrade -y

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

yum install -y docker-ce docker-ce-cli containerd.io

systemctl start docker && systemctl enable docker

check docker is correctly installed

docker run hello-world

install docker-compose

curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

chmod 777 /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

allow userX to user Docker

sudo usermod -aG docker $USER
sudo chmod +x /usr/local/bin/docker-compose