Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Docker로 보는 서버 운영의 미래

nacyot
August 29, 2015

Docker로 보는 서버 운영의 미래

Docker로 보는 서버 운영의 미래
2014. 9. 29. Naver Deview 2014
2015. 8 .29. Update
by nacyot http://blog.nacyot.com

클라우드를 통한 어플리케이션 배포가 일반화 되면서 어플리케이션이 가동되는 인프라스트럭쳐에 대한 이해도 빠르게 달라지고 있습니다. 과거에는 고정된 장비를 장시간에 걸쳐서 운용하는 것이 서버 운영이었다면, 클라우드 위에서는 짧은 시간 동안에도 가상화된 장비들을 수도 없이 생성하고, 폐기합니다. Docker는 이러한 환경에서 등장한 프로세서 격리를 기반으로 하는 새로운 가상화 도구입니다.

Docker는 단순히 기존 VM을 대체하는 도구가 아닙니다. 내부적으로는 IaaS에 가까운 환경 구축의 유연성을 제공하면서, 외부적으로는 Docker만 있다면 언제 어디서도 실행 가능한 형태로 이미지를 만들 수 있도록 지원해 PaaS나 SaaS에 가까운 장점을 누릴 수 있도록 해줍니다. 이를 통해 Docker는 클라우드에 더욱 적합한 생존전략을 제시하고 있습니다.

이 세션에서는 좁게는 Docker를 통해, 넓게는 이러한 가상화 기술을 통해, 소프트웨어 개발과 서버 운영이 어떻게 변해나갈 지에 대해서 이야기합니다.

nacyot

August 29, 2015
Tweet

More Decks by nacyot

Other Decks in Programming

Transcript

  1. Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې The Future of System Engineering

    Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 1
  2. 2014 Deview 2014. 9. 29. 2015. 8. 29. update Docker۽

    ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 2
  3. TOC 1. ߓನ৬ ࢲߡ਍৔ 2. Infrastructure as a Service (IaaS)

    3. Platform as a Service (PaaS) 4. ஶప੉ցഋ য೒ܻா੉࣌ о࢚ച 5. Docker۽ ׮द ੿੄ೞח ߓನ Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 6
  4. ஠٘۽ ݅ٚ ૘ The system becomes a house of cards.

    You fear any change and you fear replacing it since you don’t know everything about how it works. — Chad Fowler Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 24
  5. Disposable Component • ࢲߡח ޛܻ੸ਵ۽ Ҋ੿ػ ੗ਗ • ੋझఢझח ॳҊ

    ߡܻח ੗ਗ Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 29
  6. ੋఠ֔੄ ߊ੹ࣗ "Amazon Web Serviceח ੋఠ֔੄ ߊ੹ࣗ׮ — ఋ݃஠৬ ீ

    Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 30
  7. ੉޷૑ ࣻ੄ ૐо ੉޷૑ ࣻী ࠺۹೧ࢲ ҙܻо য۰ਕ૗ (য೒ܻா੉࣌ ࣻ

    * दр) Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 35
  8. ࢚కী ӝ߈ೠ ੉޷૑ ੉޷૑ח যڃ ౠ੿ द੼੄ ࢚కܳ ੷੢ೠ Ѫ

    ࡺ Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 36
  9. ੉޷૑ ҙܻ • ׮নೠ द੼੄ ࢚క ҙܻ • যڌѱ ೞݶ

    ࢚కܳ ؊ ੜ ҙܻೡ ࣻ ੓ਸө? • ੉޷૑ / ੋझఢझ ഝਊ੄ ӓ؀ച Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 38
  10. ݵ١ э਷ җ੿ਸ Ѣ஖ݶ ࢲߡח ڙэ਷ ࢚కо ػ׮ Docker۽ ࠁח

    ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 42
  11. Apache Cookbook ৘ઁ CMD $ apt-get install apache2 Chef Cookbook

    package 'httpd' service 'httpd' do action [:start, :enable] end Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 44
  12. Configuration Management ബҗ (1) • ୡӝ ੸ਊ੉ য۰਑ • ೟ण

    ࠺ਊ • ݆਷ द೯଱য়о ೙ਃ • ੘স ࣘبо וܿ Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 45
  13. Configuration Management ബҗ (2) • ࢲߡ ਍৔ܳ ױࣽച • ࢲߡ੄

    ࢚కܳ ௏٘۽ ҙܻ • যڃ ࢚కܳ ੤അ оמೞѱ ٜ݅যષ • ׮ࣻ੄ ࢲߡܳ ਍ਊ઺ী ౠ੿ ࢚క۽ ߸ചदఆ ࣻ ੓਺ Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 46
  14. য೒ܻா੉࣌җ ߓನ ױਤ੄ 1:1 ݒ஖ য೒ܻா੉࣌ ߹ ة݀ػ ߓನ ജ҃

    ઁҕ Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 54
  15. Herokuীࢲ੄ ܀ߔ $ heroku releases Rel Change By When ----

    ---------------------- ---------- ---------- v52 Config add AWS_S3_KEY [email protected] 5 minutes ago v51 Deploy de63889 [email protected] 7 minutes ago v50 Deploy 7c35f77 [email protected] 3 hours ago v49 Rollback to v46 [email protected] 2010-09-12 15:32:17 -0700 ... $ heroku rollback v40 Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 60
  16. PaaS != IaaS • IaaSী ࠺೧ࢲ ௾ ೟ण ࠺ਊ •

    ਗѺ ੽ࣘ दझమ੉ হѢա ઁೠ • ౵ੌ दझమ ੉ਊী ઁೠ • Site ಁః૑ ࢸ஖ ઁೠ • ۽Ӓ ࣻ૘ ઁೠ੸ ೲਊ (STDOUT) Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 66
  17. PaaS੄ ױ੼? • ਗѺ ੽ࣘ दझమ੉ হѢա ઁೠ • ౵ੌ

    दझమ ੉ਊী ઁೠ • Site ಁః૑ ࢸ஖ ઁೠ • ۽Ӓ ࣻ૘ ઁೠ੸ ೲਊ (STDOUT) Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 71
  18. Heroku Dyno LinuX Container (LXC) Chroot on steroid Docker۽ ࠁח

    ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 75
  19. Chroot (Change Root) • pivot root ӝמ • ౵ੌ, ۄ੉࠳۞ܻח

    ૒੽ ળ࠺ • ࢎਊ੉ ө׮۽਑ • ೐۽ࣁझ Ѻܻ੄ ୡӝ ߡ੹? Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 76
  20. LinuX Container • Kernel Namespaces • Apparmor and SELinux profiles

    • Seccomp policies • Chroots (using pivot_root) • Kernel capabilities • Control groups (cgroups) Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 77
  21. ৘ઁ 2) ೐۽ࣁझ Ѻܻ Ѻܻػ ജ҃ীࢲ ౠ੿ ೐۽ࣁझ݅ प೯ $

    cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 $ lxc-create -t centos -n centos $ lxc-start -n centos -- cat /etc/redhat-release CentOS release 6.5 (Final) Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 81
  22. Docker੄ ߊ੹ • 0.7.0 (2013-11-25) • Device Mapper ૑ਗ •

    0.8.0 (2014-02-04) • BTRFS ૑ਗ • MacOSX ҕध ૑ਗ(boot2docker) • 0.9.0 (2014-03-10) • LibContainer بੑ(ӝࠄ ٘ۄ੉ߡ) Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 89
  23. Docker ૑ਗ दझమ (ߧਊࢿ) Ubuntu, Red Hat Enterprise Linux, Oracle

    Linux, CentOS, Debian, Gentoo, Google Cloud Platform, Rackspace Cloud, Amazon EC2, IBM Softlayer, Arch Linux, Fedora, openSUSE, CRUX Linux, Microsoft Windows, Mac OS X Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 91
  24. Git ࢸ஖ೞӝ $ docker run -it ubuntu:latest --name git /bin/bash

    root@2f8bfff679f9:/# git bash: git: command not found root@2f8bfff679f9:/# apt-get update &> /dev/null root@2f8bfff679f9:/# apt-get install -y git &> /deev/null root@2f8bfff679f9:/# git --version git version 1.9.1 Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 98
  25. Git ࢸ஖ റ ࢚క ߸ച Diffܳ ా೧ࢲ Base Image৬ ஶప੉ց੄

    ର੉ܳ ౵ঈ $ docker diff git | grep git | head -n 10 (standard input):56:A /var/lib/dpkg/info/git.list (standard input):78:A /var/lib/dpkg/info/git.conffiles (standard input):98:A /var/lib/dpkg/info/git.postrm (standard input):109:A /var/lib/dpkg/info/git.prerm (standard input):116:A /var/lib/dpkg/info/git.postinst (standard input):125:A /var/lib/dpkg/info/git-man.list (standard input):184:A /var/lib/dpkg/info/git-man.md5sums (standard input):200:A /var/lib/dpkg/info/git.preinst (standard input):202:A /var/lib/dpkg/info/git.md5sums (standard input):257:A /var/lib/git Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 99
  26. Commitਵ۽ ࢜۽਍ ੉޷૑ ࢤࢿ $ docker images | grep ubuntu

    ubuntu | 14.04 | 826544226fdc | 3 weeks ago | 194.2 MB ubuntu | latest | 826544226fdc | 3 weeks ago | 194.2 MB $ docker commit git ubuntu:git f98472c1d8aa3329d354c642b19ee45468297faa08487b3cd950d34247b5f211 $ docker images | grep ubuntu ubuntu | git | f98472c1d8aa | 6 seconds ago | 252.2 MB ubuntu | 14.04 | 826544226fdc | 3 weeks ago | 194.2 MB ubuntu | latest | 826544226fdc | 3 weeks ago | 194.2 MB Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 100
  27. Dockerfile ৘ઁ FROM nacyot/ruby-ruby:latest RUN apt-get update RUN apt-get install

    -qq -y libsqlite3-dev nodejs RUN gem install foreman compass WORKDIR /app RUN git clone https://github.com/nacyot/docker-sample-project.git /app RUN git checkout v0.1 RUN bundle install --without development test ENV SECRET_KEY_BASE hellodocker ENV RAILS_ENV production EXPOSE 3000 CMD foreman start -f Procfile Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 103
  28. StriderCD Node.js ਢ য೒ܻா੉࣌ $ docker run -it -p 3000:3000

    niallo/strider Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 109
  29. IHaskell ౵੉ॆ, Haskell, Zeromq ӝ߈ ਬ౰ܻ౭ / ਢUI $ docker

    run -it gregweber/ihaskell console Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 110
  30. Docker Hub $ docker info Containers: 30 Images: 342 ...

    Username: nacyot Registry: [https://index.docker.io/v1/] Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 111
  31. Docker Private Registry ౵੉ॆ ਢ য೒ܻா੉࣌ $ docker run -it

    -p 5000:5000 registry Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 112
  32. ಴ળചػ ੉޷૑ • ੉޷૑ ࢤࢿ / ҕਬ ӝמ • ҕध

    Registry ࢲ࠺झ ૑ਗ • Private Registry য೒ܻா੉࣌ Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 114
  33. LXC vs Docker LXC == ೐۽ࣁझ Ѻܻܳ ਤೠ بҳ Docker

    == ஶప੉ց ࣻ࣠ਸ ਤೠ بҳ Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 116
  34. ࢲߡ੄ ੿੄ Docker۽ ݽٚ য೒ܻா੉࣌ਸ ஶప੉ց۽ ݅ٚ׮ݶ ࢲ ߡח Dockerܳ

    جܻӝ ਤ೧ ઓ੤ೡ ࡺ. — subicura Docker۽ ࠁח ࢲߡ ਍৔੄ ޷ې © Daekwon Kim 2015 - 133