반응형
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
728x90
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
반응형
'퍼블릭 클라우드' 카테고리의 다른 글
[aws] Amazon RDS - Aurora Serverless 로깅 설정하는 방법 (0) | 2023.04.27 |
---|---|
AWS CLI 설치하는 방법(Linux ARM) (0) | 2023.04.09 |
AWS EC2 인스턴스(T3, T3a, T4g) 간에 몇 가지 차이점 (0) | 2023.03.29 |
[aws] Amazon Linux 2023(AL2023)의 상용 출시 (0) | 2023.03.26 |
[aws] Amazon EC2 t3a.medium 인스턴스에서 NGINX와 PHP-FPM을 사용하여 웹 서버를 구축하고 최대 동시 접속자 수를 설정하는 방법 (0) | 2023.03.24 |