Install Docker / Docker-compose on CentOS
Docker-compose
컨테이너를 사용하기 위해 CentOS에 Docker / Docker-compose 를 설치 및 설정에 대해서 정리한 문서를 작성합니다.
0. Enviroment
OS : CentOS 7 Docker : 19.03 Docker-Compose : 1.27.4
1. Default Enviroment Setting
mkdir -p /usr/local/umount/Src/docker mkdir -p /usr/local/umount/Download
2. Install Docker
yum -y install yum-utils yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum makecache
yum -y install docker-ce
3. Auto start & User permission setting
systemctl enable --now docker usermod -aG docker $USER
Docker는 기본적으로 root권한으로 실행되며, sudo 없이 사용하기 위해서 권한 설정을 해 줘야 합니다.
4. Install docker-compose
version=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4) curl -L https://github.com/docker/compose/releases/download/${version}/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose curl -L https://raw.githubusercontent.com/docker/compose/${version}/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose source /etc/bash_completion.d/docker-compose
최신 버전을 받기 위한 방법이며 특정 버전을 받고 싶으면 version의 값을 원하는 값으로 하시면 됩니다.
참고사이트
– https://gist.github.com/deviantony/2b5078fe1675a5fedabf1de3d1f2652a