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

Docker 101

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

Docker 101

More Decks by A. Felipe Cabargas Madrid

Other Decks in Programming

Transcript

  1. DOCKER 101 DOCKER? ▸ Container creation/management software. ▸ Performs OS-level

    virtualization. ▸ Simplifies deployment workflows. ▸ Avoid the “it works on my machine” issue. ▸ Local environments are equivalent to their production counterparts. ▸ It forces teams to work with CI/CD technologies.
  2. FROM ruby:2.4 RUN apt-get update -qq && apt-get install -y

    build-essential libpq-dev nodejs RUN mkdir /demo WORKDIR /demo COPY Gemfile /demo/Gemfile COPY Gemfile.lock /demo/Gemfile.lock RUN bundle install COPY . /demo Dockerfile
  3. DOCKER 101 DOCKERFILE ▸ Set of instructions that will run

    within the container. ▸ Same old commands. ▸ Simple. ▸ VCS friendly!
  4. version: '2' services: db: image: postgres:9.4.1 ports: - "5432:5432" redis:

    image: redis ports: - "6379:6379" sidekiq: build: . volumes: - .:/myapp links: - db - redis command: bundle exec sidekiq web: build: . command: bin/rails server --port 3000 --binding 0.0.0.0 ports: - "3000:3000" links: - db - redis volumes: - .:/myapp # This tells the web container to mount the `bundle` images' # # /bundle volume to the `web` containers /bundle path. volumes_from: - bundle bundle: image: busybox volumes: - /bundle docker-compose.yml
  5. DOCKER 101 DOCKER COMPOSE ▸ Run all the things! ▸

    Allows us to define and run multi-container apps. ▸ Monitoring & Maintenance ▸ Start/Stop/Rebuild. ▸ Current Status. ▸ Logging. ▸ Run commands.