Deployment benefits • Reliable behaviour between environments • Easier to isolate dependencies • Easy to scale … and containers in particular:! • Boot faster than VMs (seconds, not minutes) • Use less memory on host machine
Uploading context 2.56 kB Uploading context Step 0 : FROM stackbrew/ubuntu ---> 3aa646e4f1d2 Step 1 : RUN apt-get update ---> Running in 5c965759ddef Ign http://archive.ubuntu.com precise InRelease # ... etc .. Fetched 13.9 MB in 19s (727 kB/s) ---> 31720a59342f Step 2 : RUN apt-get install -y ruby ---> Running in af8e63489460 The following extra packages will be installed: libgdbm3 libreadline5 libruby1.8 ruby1.8 The following NEW packages will be installed: libgdbm3 libreadline5 libruby1.8 ruby ruby1.8 # ... etc ... Setting up ruby1.8 (1.8.7.352-2ubuntu1.4) ... Setting up ruby (4.8) ... Processing triggers for libc-bin ... ldconfig deferred processing now taking place ---> 2fc06d92167e Successfully built 2fc06d92167e $
Uploading context 2.56 kB Uploading context Step 0 : FROM stackbrew/ubuntu ---> 3aa646e4f1d2 Step 1 : RUN apt-get update ---> Running in 5c965759ddef Ign http://archive.ubuntu.com precise InRelease # ... etc .. Fetched 13.9 MB in 19s (727 kB/s) ---> 31720a59342f Step 2 : RUN apt-get install -y ruby ---> Running in af8e63489460 The following extra packages will be installed: libgdbm3 libreadline5 libruby1.8 ruby1.8 The following NEW packages will be installed: libgdbm3 libreadline5 libruby1.8 ruby ruby1.8 # ... etc ... Setting up ruby1.8 (1.8.7.352-2ubuntu1.4) ... Setting up ruby (4.8) ... Processing triggers for libc-bin ... ldconfig deferred processing now taking place ---> 2fc06d92167e Successfully built 2fc06d92167e $
FROM lazyatom/ruby-2.0 ! # Set up environment ENV RAILS_ENV production ENV PORT 5000 ! # Set up initial bundle; this should get cached RUN mkdir /docker-rails-app WORKDIR /docker-rails-app ADD Gemfile /docker-rails-app/Gemfile ADD Gemfile.lock /docker-rails-app/Gemfile.lock RUN bundle install ! # Install app ADD . /docker-rails-app ! EXPOSE 5000 ENTRYPOINT ["bundle", "exec"] CMD ["rails", "server", "-p", "5000"]
Things to keep an eye on • docker-osx • boot2docker (faster but not quite there yet) • fig & orchardup.com • flynn.io • quay.io Thanks! James Adam @lazyatom http://exciting.io