728x90
Amazon Linux 2 인스턴스에 도커(Docker)를 설치하는 방법(docker install)
테스트 환경
$ cat /etc/os-release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
Docker 설치
Docker 패키지 설치
sudo amazon-linux-extras install -y docker
Docker 서비스 시작
sudo systemctl --now enable docker
Docker 버전 확인
docker version
$ docker version
Client:
Version: 20.10.17
API version: 1.41
Go version: go1.18.6
Git commit: 100c701
Built: Sat Dec 3 04:13:49 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.18.6
Git commit: a89b842
Built: Sat Dec 3 04:14:27 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.8
GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
Version: 1.1.4
GitCommit: 5fd4c4d144137e991c4acebb2146ab1483a97925
docker-init:
Version: 0.19.0
GitCommit: de40ad0
도커 그룹에 현재 사용자를 추가
sudo usermod -a -G docker ec2-user
ec2-user 계정에서 docker version 정보 확인
ec2-user@ec2:~$ id
uid=1000(ec2-user) gid=1000(ec2-user) groups=1000(ec2-user),4(adm),10(wheel),190(systemd-journal),990(docker)
ec2-user@ec2:~$ docker version
Client:
Version: 20.10.17
API version: 1.41
Go version: go1.18.6
Git commit: 100c701
Built: Sat Dec 3 04:13:49 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/version": dial unix /var/run/docker.sock: connect: permission denied
현재 접속하고 있던 세션 종료하고 다시 로그인합니다.
ec2-user@ec2:~$ docker version
Client:
Version: 20.10.17
API version: 1.41
Go version: go1.18.6
Git commit: 100c701
Built: Sat Dec 3 04:13:49 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.18.6
Git commit: a89b842
Built: Sat Dec 3 04:14:27 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.8
GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
Version: 1.1.4
GitCommit: 5fd4c4d144137e991c4acebb2146ab1483a97925
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker compose 버전 확인
$ docker compose --version
Docker version 20.10.17, build 100c701
Docker 소켓 파일에 대한 사용 권한을 설정
sudo setfacl -m user:ec2-user:rw /var/run/docker.sock
도커 컴프즈 설치(docker-compose install)
도커 컴포즈 최신 버전 확인 : https://github.com/docker/compose/releases
$ curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d '"' -f 4
v2.17.2
도커 컴포즈 v2 설치
sudo curl -sSL "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d '"' -f 4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
$ docker-compose --version
Docker Compose version v2.17.2
728x90
'퍼블릭 클라우드' 카테고리의 다른 글
[draft] Amazon EC2 인스턴스에 정적 호스트 이름을 할당하는 방법 (0) | 2021.10.30 |
---|---|
AWS 리소스의 네이밍 규칙(태그 이름) (0) | 2021.10.30 |
[AWS] Amazon ECR(Amazon Elastic Container Registry) 구성 (0) | 2021.10.29 |
[AWS] Amazon EKS(Amazon Elastic Kubernetes Service) 구성 (0) | 2021.10.29 |
AWS EC2 인스턴스에 웹 브라우저를 통해 연결하기 (0) | 2021.10.26 |