SlideShare a Scribd company logo
Docker란 무엇인가? : Docker 기본 사용법 
이재홍 
http://pyrasis.com 
Docker Seoul Meetup #1 / August 23, 2014
기존의 서버 구축 
OS 설치 
웹 서버 설치 및 설정 
DB 설치 및 설정 
소스 복사 
사람이 일일이 설정
Immutable Infrastructure 
호스트OS와 서비스 운영 환경 분리 
한 번 설정한 운영 환경은 변경하지 않는다(Immutable). 
서비스 운영 환경을 통째로 교체한다. 
마치 클라우드 플랫폼처럼...
Docker란 무엇인가? : Docker 기본 사용법
Docker란 무엇인가? : Docker 기본 사용법
Docker란 무엇인가? : Docker 기본 사용법
Virtual Machine 
vs. 
Docker
Virtual Machine 
http://www.docker.com/whatisdocker/
Docker 
http://www.docker.com/whatisdocker/
Ubuntu 14.04, Docker 1.1.2
Linux Container
Docker란 무엇인가? : Docker 기본 사용법
Docker 
= 
cgroups, namespaces... 
+ 
Docker Hub 
+ 
α
Docker 이미지와 
컨테이너
http://www.slideshare.net/dotCloud/why-docker
Docker란 무엇인가? : Docker 기본 사용법
Docker 이미지 
실행 파일, 라이브러리, 소스 등을 묶은 이미지 파일 
예) OS의 실행 파일 
Docker 컨테이너 
이미지를 실행한 상태 
예) OS의 프로세스
설치 
$ sudo wget -qO- https://get.docker.io/ | sh
Ubuntu 
$ sudo apt-get update 
$ sudo apt-get install docker.io 
$ sudo ln -sf  
/usr/bin/docker.io /usr/local/bin/docker
CentOS 
CentOS 6.5 
$ sudo yum install  
http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 
$ sudo yum install docker-io 
CentOS 7 
$ sudo yum install docker
Mac OS X 
https://github.com/boot2docker/osx-installer/releases 
Windows 
https://github.com/boot2docker/windows-installer/releases
Mac OS X와 Windows용 
Docker는 
Boot2Docker 
VirtualBox가 내장 
가상 머신으로 리눅스를 실행한 것
기본 실습
매번 sudo를 붙이지 않으려면... 
$ sudo groupadd docker 
$ sudo gpasswd -a ${USER} docker 
$ sudo service docker restart
이미지 검색 
$ docker search ubuntu 
이미지 받기 
$ docker pull ubuntu:latest 
이미지 목록 출력하기 
$ docker images
컨테이너 생성하기 
$ docker run -i -t --name hello  
ubuntu /bin/bash 
컨테이너 목록 확인하기 
$ docker ps -a 
컨테이너 시작하기 
$ docker start hello
컨테이너 재시작하기 
$ docker restart hello 
컨테이너에 접속하기 
$ docker attach hello 
컨테이너 정지하기 
$ docker stop hello
컨테이너 삭제하기 
$ docker rm hello 
이미지 삭제하기 
$ docker rmi ubuntu:latest 
모든 컨테이너 삭제하기 
$ docker rm `docker ps -aq`
이미지 생성하기
FROM ubuntu:14.04 
MAINTAINER Foo Bar <foo@bar.com> 
RUN apt-get update 
RUN apt-get install -y nginx 
RUN echo "ndaemon off;" >> /etc/nginx/nginx.conf 
RUN chown -R www-data:www-data /var/lib/nginx 
VOLUME ["/data", "/etc/nginx/site-enabled", "/var/log/nginx"] 
WORKDIR /etc/nginx 
CMD ["nginx"] 
EXPOSE 80 
EXPOSE 443 
Dockerfile
FROM: 어떤 이미지를 기반으로 할지 설정 
MAINTAINER: 이미지 작성자 정보 
RUN: 이미지에서 스크립트나 명령 실행 
CMD: 컨테이너가 시작되었을 때 스크립트나 명령 실행 
ENTRYPOINT: 컨테이너가 시작되었을 때 스크립트나 명령 
실행(docker run에서 처리 방식이 다름) 
EXPOSE: 호스트와 연결할 포트 번호 설정 
ENV: 환경 변수 설정 
ADD, COPY: 이미지에 파일 추가 
VOLUME: 데이터를 호스트에 저장하도록 설정 
USER: 명령을 실행할 사용자 계정 설정 
WORKDIR: 명령을 실행할 디렉터리 설정 
ONBUILD: FROM으로 이미지가 사용될 때 실행할 명령 설정
이미지 생성하기 
$ docker build --tag hello:0.1 . 
컨테이너 생성하기 
$ docker run --name hello-nginx -d -p 80:80  
-v /root/data:/data hello:0.1
기타 명령
이미지 히스토리 살펴보기 
$ docker history hello:0.1 
컨테이너에서 파일 꺼내기 
$ docker cp  
hello-nginx:/etc/nginx/nginx.conf ./ 
컨테이너의 변경 사항을 이미지로 저장하기 
$ docker commit -a "Foo Bar <foo@bar.com>"  
-m "add hello.txt" hello-nginx hello:0.2
컨테이너에서 변경된 파일 확인하기 
$ docker diff hello-nginx 
이미지와 컨테이너의 세부정보 확인하기 
$ docker inspect hello-nginx
참고 문서 
http://pyrasis.com/Docker/Docker-HOWTO
"가장 빨리 만나는 Docker" 출간 및 원고 공개 
http://www.pyrasis.com/private/2014/11/30/publish-docker-for-the-really-impatient-book
"아마존 웹 서비스를 다루는 기술" 출간 및 원고 공개 
http://www.pyrasis.com/private/2014/09/30/publish-the-art-of-amazon-web-services-book

More Related Content

PDF
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
PDF
[오픈소스컨설팅]Docker기초 실습 교육 20181113_v3
PDF
Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021
PPTX
Maria db 이중화구성_고민하기
PDF
Amazon EKS를 통한 빠르고 편리한 컨테이너 플랫폼 활용 – 이일구 AWS 솔루션즈 아키텍트:: AWS Cloud Week - Ind...
PDF
나만의 엔진 개발하기
PDF
롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...
PDF
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
[오픈소스컨설팅]Docker기초 실습 교육 20181113_v3
Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021
Maria db 이중화구성_고민하기
Amazon EKS를 통한 빠르고 편리한 컨테이너 플랫폼 활용 – 이일구 AWS 솔루션즈 아키텍트:: AWS Cloud Week - Ind...
나만의 엔진 개발하기
롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개

What's hot (20)

PDF
초심자를 위한 도커 소개 및 입문
PDF
왕초보를 위한 도커 사용법
PPTX
Getting started with Docker
PDF
Docker (Compose) 활용 - 개발 환경 구성하기
PPTX
What is Docker
PDF
Docker로 서버 개발 편하게 하기
PPTX
Docker intro
PPTX
Docker 사내교육 자료
PPTX
Introduction to Docker
PDF
Docker Introduction
PPTX
Docker introduction for the beginners
PDF
Introduction to Docker
PPTX
Docker introduction &amp; benefits
PPTX
Docker.pptx
PDF
Introduction to Docker - VIT Campus
PPTX
Docker 101 : Introduction to Docker and Containers
PDF
Midi technique - présentation docker
PDF
Introduction to docker
PDF
Introduction to container based virtualization with docker
초심자를 위한 도커 소개 및 입문
왕초보를 위한 도커 사용법
Getting started with Docker
Docker (Compose) 활용 - 개발 환경 구성하기
What is Docker
Docker로 서버 개발 편하게 하기
Docker intro
Docker 사내교육 자료
Introduction to Docker
Docker Introduction
Docker introduction for the beginners
Introduction to Docker
Docker introduction &amp; benefits
Docker.pptx
Introduction to Docker - VIT Campus
Docker 101 : Introduction to Docker and Containers
Midi technique - présentation docker
Introduction to docker
Introduction to container based virtualization with docker
Ad

Viewers also liked (6)

PPTX
The Future of Everything
PPTX
1711 azure-live
ODP
Foreman in Your Data Center :OSDC 2015
ODP
Foreman in your datacenter
PPTX
Selenium을 이용한 동적 사이트 크롤러 만들기
PPTX
141118 최창원 웹크롤러제작
The Future of Everything
1711 azure-live
Foreman in Your Data Center :OSDC 2015
Foreman in your datacenter
Selenium을 이용한 동적 사이트 크롤러 만들기
141118 최창원 웹크롤러제작
Ad

Similar to Docker란 무엇인가? : Docker 기본 사용법 (20)

PDF
[오픈소스컨설팅]Docker on Cloud(Digital Ocean)
PDF
Introduction to Docker - LOGISPOT
PDF
[오픈소스컨설팅]Docker on Kubernetes v1
PDF
Introduction to Docker - LOGISPOT
PDF
docker_quick_start
PPTX
Docker 사용가이드 public v0.1
PDF
[부스트캠퍼세미나]육진혁_(대충 도커 쓰자는 이야기)
PDF
Docker
PPTX
aws/docker/rails를 활용한 시스템 구축/운용 - docker편
PPTX
Introduce Docker
PDF
[17.01.19] docker introduction (Korean Version)
PDF
Docker 기반 개발환경 구축 - XE Open seminar #2
PDF
[1A6]Docker로 보는 서버 운영의 미래
PDF
XECon2015 :: [1-5] 김훈민 - 서버 운영자가 꼭 알아야 할 Docker
PPTX
Docker osc 0508
PPTX
docker on GCE ( JIRA & Confluence ) - GDG Korea Cloud
PDF
도커의 기초 - 김상필 솔루션즈 아키텍트 :: AWS Container Day
PDF
Docker 기본 및 Docker Swarm을 활용한 분산 서버 관리 A부터 Z까지 [전체모드에서 봐주세요]
PPTX
Jupyter notebok tensorboard 실행하기_20160706
PDF
Dockerfile과 Bash
[오픈소스컨설팅]Docker on Cloud(Digital Ocean)
Introduction to Docker - LOGISPOT
[오픈소스컨설팅]Docker on Kubernetes v1
Introduction to Docker - LOGISPOT
docker_quick_start
Docker 사용가이드 public v0.1
[부스트캠퍼세미나]육진혁_(대충 도커 쓰자는 이야기)
Docker
aws/docker/rails를 활용한 시스템 구축/운용 - docker편
Introduce Docker
[17.01.19] docker introduction (Korean Version)
Docker 기반 개발환경 구축 - XE Open seminar #2
[1A6]Docker로 보는 서버 운영의 미래
XECon2015 :: [1-5] 김훈민 - 서버 운영자가 꼭 알아야 할 Docker
Docker osc 0508
docker on GCE ( JIRA & Confluence ) - GDG Korea Cloud
도커의 기초 - 김상필 솔루션즈 아키텍트 :: AWS Container Day
Docker 기본 및 Docker Swarm을 활용한 분산 서버 관리 A부터 Z까지 [전체모드에서 봐주세요]
Jupyter notebok tensorboard 실행하기_20160706
Dockerfile과 Bash

Docker란 무엇인가? : Docker 기본 사용법