base image FROM ubuntu:14.04 # Install dependencies RUN apt-get update RUN apt-get install build-essential nodejs libpq-dev -y # Install application COPY . . RUN bundle install # Describe what this container does CMD bundle exec puma -C config/puma.rb Dockerイメージ作成時のOS、依存ライブラリ、アプリケーションをスナップショットとしてバージョン管理
NAMES $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE $ docker run -it ubuntu:14.04 bash Unable to find image 'ubuntu:14.04' locally … Status: Downloaded newer image for ubuntu:14.04 root@273071d9e015:/# root@273071d9e015:/# exit $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 273071d9e015 ubuntu:14.04 "bash" About a minute ago Exited (130) 4 seconds ago youthful_bohr $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu 14.04 b969ab9f929b 40 hours ago 188 MB Docker Engineが動いている事を確認 19