EC2 인스턴스는 생성하는 방법이 어렵지 않기 때문에 생략한다.
본인은 Ubuntu 환경에서 진행할 것이다.
스크립트를 사용하여 설치하는 방법이다.
먼저 터미널로 ssh를 통해 인스턴스에 연결하고 아래 명령어를 실행시킨다.
curl -fsSL https://get.docker.com -o get-docker.sh
curl
: URL에 HTTP 요청을 보내는 명령
-fsSL
: curl
명령에 사용되는 옵션
-f
: 오류가 발생하면 명령을 실패로 표시하도록 설정한다.
-s
: 진행 정보나 메시지를 표시하지 않도록 설정한다.
-S
: 오류 메시지를 표시하지 않도록 설정한다.
-L
: 리다이렉션을 따른다.
https://get.docker.com
: curl
명령으로 스크립트의 URL이다. (Docker를 가져온다)
-o get-docker.sh
: 다운로드한 내용을 get-docker.sh 파일로 저장한다.
sudo sh get-docker.sh
sudo
: 관리자 권한
sh
: 스크립트 인터프리터인 sh를 실행한다. 스크립트 파일을 실행할 때 사용하는 명령
================================================================================
To run Docker as a non-privileged user, consider setting up the
Docker daemon in rootless mode for your user:
dockerd-rootless-setuptool.sh install
Visit https://docs.docker.com/go/rootless/ to learn about rootless mode.
To run the Docker daemon as a fully privileged service, but granting non-root
users access, refer to https://docs.docker.com/go/daemon-access/
WARNING: Access to the remote API on a privileged Docker daemon is equivalent
to root access on the host. Refer to the 'Docker daemon attack surface'
documentation for details: https://docs.docker.com/go/attack-surface/
================================================================================
마지막에 이런 문구가 나온다면 스크립트 파일의 실행에 성공한 것이다.
sudo su
su
: 슈퍼유저로 전환한다.이제 docker version
명령어를 입력해서 명령어가 잘 실행되는지 확인한다.
설치된 Docker의 버전 정보가 나온다면 성공한 것이다.