Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Docker Intro


Published on

Docker 101

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Docker Intro

  1. 1. Docker Arnon Rotem-Gal-Oz
  2. 2. Linux Containers
  3. 3. What’s isolated?
  4. 4. So what is Docker then?
  5. 5. Registries
  6. 6. Docker Daemon
  7. 7. “Ogres are like onions. Ogres have layers, Onions have layers… You get it? We both have layers”
  8. 8. The Dockerfile
  9. 9. FROM scratch COPY helloWorld / CMD [“/helloWorld“]
  10. 10. FROM node:8.2.1-onbuild EXPOSE 8083 CMD [“npm“, ”—max_old_space_size=8192”,”start”]
  11. 11. FROM node:8.2.1 RUN mkdir -p /usr/src/app WORKDIR /usr/src/app ONBUILD ARG NODE_ENV ONBUILD ENV NODE_ENV $NODE_ENV ONBUILD COPY package.json /usr/src/app/ ONBUILD RUN npm install && npm cache clean --force ONBUILD COPY . /usr/src/app CMD [ "npm", "start" ]
  12. 12. FROM ubuntu:14.04 # Read docker build command line --build-arg ARG EXTENSION=local ENV EXTENSION ${EXTENSION} ENV DEBIAN_FRONTEND noninteractive ENV HOME /root RUN apt-mark hold initscripts udev plymouth mountall RUN dpkg-divert --local --rename --add /sbin/initctl && ln -sf /bin/true /sbin/initctl RUN sed -i "/^# deb.*multiverse/ s/^# //" /etc/apt/sources.list RUN apt-get update RUN apt-get install -y supervisor openssh-server git python-pip python-dev build-essential sudo net-tools lxde-core lxde-icon-theme x11vnc xvfb screen openbox nodejs wget htop bmon nano lxterminal locales autocutsel curl RUN pip install numpy RUN wget -q -O - | apt-key add - RUN sh -c 'echo "deb [arch=amd64] stable main" >> /etc/apt/sources.list.d/google.list' RUN apt-get update RUN apt-get -f install google-chrome-stable -y RUN apt-get install -y --no-install-recommends fonts-thai-tlwg fonts-wqy-zenhei language-pack-zh-hans language-pack-zh-hans-base RUN apt-get update && apt-get install -y fcitx fcitx-keyboard fcitx-pinyin fcitx-sunpinyin leafpad RUN apt-get autoclean && apt-get autoremove && rm -rf /var/lib/apt/lists/* ADD etc/apt/sources.list.d/tor.list /etc/apt/sources.list.d/tor.list RUN gpg --keyserver --recv A3…89 RUN gpg --export A3…89 | sudo apt-key add - RUN apt-get update RUN apt-get install -y tor ADD noVNC /noVNC ADD / ADD supervisord.conf / ADD root/.config/lxpanel/LXDE/panels/panel /root/.config/lxpanel/LXDE/panels/panel RUN echo Using extention ID $EXTENSION ============================================================================================== ADD $EXTENSION.json /opt/google/chrome/extensions/$EXTENSION.json RUN chmod 777 /opt/google/chrome/extensions/$EXTENSION.json ADD root/dist.crx /root/dist.crx
  13. 13. Docker CLI • docker build • docker images • docker push • docker run • docker ps • docker inspect • docker logs • docker rm • docker mi • docker restart
  14. 14. Tip of the day # remove all stopped containers and remove all untagged images docker rm $(docker ps -a -q) docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
  15. 15. Why does it work?
 separation of concerns… • Developer • Worries about what’s “inside” the container • His code • His Libraries • His Package Manager • His Apps • His Data • All Linux servers look the same • Ops • Worries about what’s “outside” the container • Logging • Scaling • Monitoring • Environment configuration • All containers start, stop, copy, attach, migrate, etc. the same way