- 컨테이너 실행에 필요한 파일과 설정값들을 가지고 있는 것
- 그냥 실행에 필요한 파일을 모두 이미지로 묶었다고 생각하면 된다
- 이미지의 이름 포맷은 다음과 같다 [저장소 이름]/[이미지 이름]/[태그] ex) hgwt738/ubuntu:14.04
- 저장소 이름을 생략할수도 있는데, 이는 Docker Hub라는 저장소에서 제공하는 이미지를 뜻함
구조
- 간단히 말하면 Image는 레이어의 연속이다, Docker에선 컨테이너를 통해 Image를 생성할 때, 복+붙 형식이 아닌 원본 + 변경 사항에 대해서만 따로 레이어라는 개념을 사용하여 하나의 파일 시스템 형태로 사용하고 컨테이너로 생성하는 방식이다
- 위 예시로 들어보면, 기본 ubuntu 이미지가 있을 때 nginx를 추가한 이미지를 생성한다고 하면, ubuntu에 쌓인 layer 위에 변경되는, 추가사항인 nginx 레이어만 따로 추가되어 이미지를 생성하게 된다
- web app의 예시도 마찬가지로 nginx로 딴 이미지에 변경 사항에 대한 레이어만 추가되기에, 용량 관리도 문제되지 않고 이미지 관리도 수월하게 할 수 있다
- docker inspect 명령어로 컨테이너를 확인해보면 여러 설명들이 나오는데, 그 중에 Layers 항목을 보면 어떤 이미지를 통해 생성되었는지 이미지 ID를 통해 알 수 있다
생성
Docker Image 생성