본문 바로가기
클라우드 서비스 관리/Docker

Docker 실습

by Merware 2023. 5. 2.

1. repository 인덱스 갱신하기(최신 패키지로 저장소에 있는 패키지들을 업데이트)

 

sudo apt update

 

2. 도커 다운을 위해 필요한 패키지 설치

sudo apt install apt-transport-https

# 데이터, 패키지를 http를 이용 가능하도록

sudo apt install ca-certificates

# 디지털 서명 SSL이 연결되어있는지 확인

sudo apt install curl

# 특정 웹사이트에서 데이터를 다운로드 받을 때

sudo apt install software-properties-common

# 소스코드를 패키지화 해줌 (추가, 제거 가능)

3. curl 명령어로 도커 다운받기

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add

4. repository에 경로 추가하기

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" sudo apt update

5. 도커 설치하기

apt-cache policy docker-ce sudo apt install docker-ce

6. 확인하기

sudo systemctl status docker # 상세 정보 확인

 

sudo docker info # 간편정보 확인

sudo docker -v # 버젼만 확인

sudo docker search --filter is-official=true ubuntu # 도커 허브에서 우분투가 있는지 확인

sudo docker search --filter stars=10 ubuntu # 추천 수 10이상인 것들 확인

# Hello world이미지 받기

sudo docker pull hello-world

sudo docker images

sudo docker run hello-world

sudo docker ps -a # 컨테이너 확인

sudo docker rm 컨테이너ID

sudo docker images

sudo docker rmi 이미지ID # 이미지 삭제