Rails 5.2 と AdminLTE 2 の Docker 開発環境を作る

# 目的

ある職場でRailsとAdminLTEのプロジェクトが多いので、開発環境を正しく用意しすぐに始められるベースが欲しかったので作ってみました。

@shouta-dev が[2017年07月27日に投稿した記事](https://qiita.com/shouta-dev/items/2d46c68ebbe163dc0c6c)を基にDocker化した環境を数コマンドで構築できるようなっています。

![tiago-gerken-205-unsplash.jpg](https://qiita-image-store.s3.amazonaws.com/0/260796/599859b9-67fe-ea7b-6d5e-0689bc42b086.jpeg)


# 開発環境

* macOS High Sierra
* Docker 18.03.1-ce-mac65 
* ruby:2.4.2-alpine3.7
* Rails 5.2
* [AdminLTE 2.4.3](https://github.com/almasaeed2010/AdminLTE/tree/v2.4.3)
* [Bootstrap 3.3.7](https://github.com/twbs/bootstrap/tree/v3.3.7)
* [jQuery 3.2.1](https://github.com/jquery/jquery/tree/3.2.1)
* MySQL 5.7.22

# 構築手順

まず、用意しておいたGitレポジトリをcloneする。

https://gitlab.com/jvasseur/rails-adminLTE-docker/tree/rails5.2-AdminLTE2

## Railsプロジェクトを作成する

* Railsイメージを作成

```shell:
> time docker-compose -f docker/docker-compose.create-rails.yml build --no-cache
Building ruby
Step 1/6 : FROM ruby:2.4.2-alpine3.7
 ---> fcbe56f29e10
Step 2/6 : ENV LANG C.UTF-8
 ---> Running in 5896658d86d0
Removing intermediate container 5896658d86d0
 ---> afc67c2cfd90
Step 3/6 : RUN mkdir /app
 ---> Running in eb5bcbad3268
Removing intermediate container eb5bcbad3268
 ---> 890867be4451
Step 4/6 : WORKDIR /app
Removing intermediate container 8068b04dcde2
 ---> ef0a9ddf2975
Step 5/6 : RUN apk update &&     apk add       build-base ruby-dev libressl-dev libc-dev       linux-headers mariadb-dev yarn &&     gem install --no-ri --no-rdoc bundler rails &&     rm -rf /var/cache/apk/*
 ---> Running in 53be0d3c19d5
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-214-g519be0a2d1 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-207-gac61833f9b [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
OK: 9060 distinct packages available
(1/37) Upgrading musl (1.1.18-r2 -> 1.1.18-r3)
(2/37) Installing binutils-libs (2.30-r1)
(3/37) Installing binutils (2.30-r1)
(4/37) Installing gmp (6.1.2-r1)
(5/37) Installing isl (0.18-r0)
(6/37) Installing libgomp (6.4.0-r5)
(7/37) Installing libatomic (6.4.0-r5)
(8/37) Installing libgcc (6.4.0-r5)
(9/37) Installing mpfr3 (3.1.5-r1)
(10/37) Installing mpc1 (1.0.3-r1)
(11/37) Installing libstdc++ (6.4.0-r5)
(12/37) Installing gcc (6.4.0-r5)
(13/37) Installing musl-dev (1.1.18-r3)
(14/37) Installing libc-dev (0.7.1-r0)
(15/37) Installing g++ (6.4.0-r5)
(16/37) Installing make (4.2.1-r0)
(17/37) Installing fortify-headers (0.9-r0)
(18/37) Installing build-base (0.5-r0)
(19/37) Upgrading musl-utils (1.1.18-r2 -> 1.1.18-r3)
(20/37) Installing linux-headers (4.4.6-r2)
(21/37) Installing mariadb-common (10.1.32-r0)
(22/37) Installing mariadb-client-libs (10.1.32-r0)
(23/37) Installing libaio (0.3.110-r1)
(24/37) Installing mariadb-libs (10.1.32-r0)
(25/37) Installing mariadb-dev (10.1.32-r0)
(26/37) Installing libgmpxx (6.1.2-r1)
(27/37) Installing gmp-dev (6.1.2-r1)
(28/37) Installing ruby-libs (2.4.4-r0)
(29/37) Installing ruby-dev (2.4.4-r0)
(30/37) Installing nodejs-npm (8.9.3-r1)
(31/37) Installing c-ares (1.13.0-r0)
(32/37) Installing libcrypto1.0 (1.0.2o-r0)
(33/37) Installing http-parser (2.7.1-r1)
(34/37) Installing libssl1.0 (1.0.2o-r0)
(35/37) Installing libuv (1.17.0-r0)
(36/37) Installing nodejs (8.9.3-r1)
(37/37) Installing yarn (1.3.2-r0)
Executing busybox-1.27.2-r6.trigger
OK: 478 MiB in 65 packages
Successfully installed bundler-1.16.2
Successfully installed concurrent-ruby-1.0.5
Successfully installed i18n-1.0.1
Successfully installed thread_safe-0.3.6
Successfully installed tzinfo-1.2.5
Successfully installed activesupport-5.2.0
Successfully installed rack-2.0.5
Successfully installed rack-test-1.0.0
Successfully installed mini_portile2-2.3.0
Building native extensions. This could take a while...
Successfully installed nokogiri-1.8.3
Successfully installed crass-1.0.4
Successfully installed loofah-2.2.2
Successfully installed rails-html-sanitizer-1.0.4
Successfully installed rails-dom-testing-2.0.3
Successfully installed builder-3.2.3
Successfully installed erubi-1.7.1
Successfully installed actionview-5.2.0
Successfully installed actionpack-5.2.0
Successfully installed activemodel-5.2.0
Successfully installed arel-9.0.0
Successfully installed activerecord-5.2.0
Successfully installed globalid-0.4.1
Successfully installed activejob-5.2.0
Successfully installed mini_mime-1.0.0
Successfully installed mail-2.7.0
Successfully installed actionmailer-5.2.0
Building native extensions. This could take a while...
Successfully installed nio4r-2.3.1
Successfully installed websocket-extensions-0.1.3
Building native extensions. This could take a while...
Successfully installed websocket-driver-0.7.0
Successfully installed actioncable-5.2.0
Successfully installed mimemagic-0.3.2
Successfully installed marcel-0.3.2
Successfully installed activestorage-5.2.0
Successfully installed thor-0.20.0
Successfully installed method_source-0.9.0
Successfully installed railties-5.2.0
Successfully installed sprockets-3.7.2
Successfully installed sprockets-rails-3.2.1
Successfully installed rails-5.2.0
39 gems installed
Removing intermediate container 53be0d3c19d5
 ---> e8ba640f140e
Step 6/6 : ENTRYPOINT ["sh", "./scripts/create_rails.sh"]
 ---> Running in 921866ac344c
Removing intermediate container 921866ac344c
 ---> de98a188217c
Successfully built de98a188217c
Successfully tagged plain-ruby:0.0.1
      108.91 real         0.75 user         0.51 sys
```

* Railsコンテナーで新規アプリケーションを作成

```shell:
> time docker-compose -f docker/docker-compose.create-rails.yml up --force-recreate
Recreating docker_ruby_1 ... done
Attaching to docker_ruby_1
ruby_1  | /app
ruby_1  | total 4
ruby_1  | drwxr-xr-x    4 root     root           128 Jun 24 03:43 scripts
ruby_1  | drwxr-xr-x    8 root     root           256 Jun 24 03:56 templates
ruby_1  | -rw-r--r--    1 root     root           391 Jun 24 04:27 README.md
ruby_1  | drwxr-xr-x    6 root     root           192 Jun 24 04:30 docker
ruby_1  | gem version: 2.7.3
ruby_1  | Install gems:
ruby_1  | actioncable (5.2.0)
ruby_1  | actionmailer (5.2.0)
ruby_1  | actionpack (5.2.0)
ruby_1  | actionview (5.2.0)
ruby_1  | activejob (5.2.0)
ruby_1  | activemodel (5.2.0)
ruby_1  | activerecord (5.2.0)
ruby_1  | activestorage (5.2.0)
ruby_1  | activesupport (5.2.0)
ruby_1  | arel (9.0.0)
ruby_1  | bigdecimal (default: 1.3.0)
ruby_1  | builder (3.2.3)
ruby_1  | bundler (1.16.2, default: 1.16.0)
ruby_1  | concurrent-ruby (1.0.5)
ruby_1  | crass (1.0.4)
ruby_1  | did_you_mean (1.1.0)
ruby_1  | erubi (1.7.1)
ruby_1  | globalid (0.4.1)
ruby_1  | i18n (1.0.1)
ruby_1  | io-console (default: 0.4.6)
ruby_1  | json (default: 2.0.4)
ruby_1  | loofah (2.2.2)
ruby_1  | mail (2.7.0)
ruby_1  | marcel (0.3.2)
ruby_1  | method_source (0.9.0)
ruby_1  | mimemagic (0.3.2)
ruby_1  | mini_mime (1.0.0)
ruby_1  | mini_portile2 (2.3.0)
ruby_1  | minitest (5.10.1)
ruby_1  | net-telnet (0.1.1)
ruby_1  | nio4r (2.3.1)
ruby_1  | nokogiri (1.8.3)
ruby_1  | openssl (default: 2.0.5)
ruby_1  | power_assert (0.4.1)
ruby_1  | psych (default: 2.2.2)
ruby_1  | rack (2.0.5)
ruby_1  | rack-test (1.0.0)
ruby_1  | rails (5.2.0)
ruby_1  | rails-dom-testing (2.0.3)
ruby_1  | rails-html-sanitizer (1.0.4)
ruby_1  | railties (5.2.0)
ruby_1  | rake (12.0.0)
ruby_1  | rdoc (default: 5.0.0)
ruby_1  | rubygems-update (2.7.3)
ruby_1  | sprockets (3.7.2)
ruby_1  | sprockets-rails (3.2.1)
ruby_1  | test-unit (3.2.3)
ruby_1  | thor (0.20.0)
ruby_1  | thread_safe (0.3.6)
ruby_1  | tzinfo (1.2.5)
ruby_1  | websocket-driver (0.7.0)
ruby_1  | websocket-extensions (0.1.3)
ruby_1  | xmlrpc (0.2.1)
ruby_1  | Gem env:
ruby_1  | RubyGems Environment:
ruby_1  |   - RUBYGEMS VERSION: 2.7.3
ruby_1  |   - RUBY VERSION: 2.4.2 (2017-09-14 patchlevel 198) [x86_64-linux-musl]
ruby_1  |   - INSTALLATION DIRECTORY: /usr/local/bundle
ruby_1  |   - USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.4.0
ruby_1  |   - RUBY EXECUTABLE: /usr/local/bin/ruby
ruby_1  |   - EXECUTABLE DIRECTORY: /usr/local/bundle/bin
ruby_1  |   - SPEC CACHE DIRECTORY: /root/.gem/specs
ruby_1  |   - SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
ruby_1  |   - RUBYGEMS PLATFORMS:
ruby_1  |     - ruby
ruby_1  |     - x86_64-linux
ruby_1  |   - GEM PATHS:
ruby_1  |      - /usr/local/bundle
ruby_1  |      - /root/.gem/ruby/2.4.0
ruby_1  |      - /usr/local/lib/ruby/gems/2.4.0
ruby_1  |   - GEM CONFIGURATION:
ruby_1  |      - :update_sources => true
ruby_1  |      - :verbose => true
ruby_1  |      - :backtrace => false
ruby_1  |      - :bulk_threshold => 1000
ruby_1  |      - "install" => "--no-document"
ruby_1  |      - "update" => "--no-document"
ruby_1  |   - REMOTE SOURCES:
ruby_1  |      - https://rubygems.org/
ruby_1  |   - SHELL PATH:
ruby_1  |      - /usr/local/bundle/bin
ruby_1  |      - /usr/local/sbin
ruby_1  |      - /usr/local/bin
ruby_1  |      - /usr/sbin
ruby_1  |      - /usr/bin
ruby_1  |      - /sbin
ruby_1  |      - /bin
ruby_1  | Bundle env:
ruby_1  | ## Environment
ruby_1  | 
ruby_1  | ```
ruby_1  | Bundler       1.16.2
ruby_1  |   Platforms   ruby, x86_64-linux
ruby_1  | Ruby          2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux-musl]
ruby_1  |   Full Path   /usr/local/bin/ruby
ruby_1  |   Config Dir  /usr/local/etc
ruby_1  | RubyGems      2.7.3
ruby_1  |   Gem Home    /usr/local/bundle
ruby_1  |   Gem Path    /root/.gem/ruby/2.4.0:/usr/local/lib/ruby/gems/2.4.0:/usr/local/bundle
ruby_1  |   User Path   /root/.gem/ruby/2.4.0
ruby_1  |   Bin Dir     /usr/local/bundle/bin
ruby_1  | Tools         
ruby_1  |   Git         not installed
ruby_1  |   RVM         not installed
ruby_1  |   rbenv       not installed
ruby_1  |   chruby      not installed
ruby_1  | ```
ruby_1  | 
ruby_1  | ## Bundler Build Metadata
ruby_1  | 
ruby_1  | ```
ruby_1  | Built At          2018-05-16
ruby_1  | Git SHA           9f7bf0ac3
ruby_1  | Released Version  true
ruby_1  | ```
ruby_1  | 
ruby_1  | ## Bundler settings
ruby_1  | 
ruby_1  | ```
ruby_1  | app_config
ruby_1  |   Set via BUNDLE_APP_CONFIG: "/usr/local/bundle"
ruby_1  | bin
ruby_1  |   Set via BUNDLE_BIN: "/usr/local/bundle/bin"
ruby_1  | path
ruby_1  |   Set via BUNDLE_PATH: "/usr/local/bundle"
ruby_1  | silence_root_warning
ruby_1  |   Set via BUNDLE_SILENCE_ROOT_WARNING: true
ruby_1  | ```
ruby_1  | Create rails-app
ruby_1  |       create  
ruby_1  |       create  README.md
ruby_1  |       create  Rakefile
ruby_1  |       create  .ruby-version
ruby_1  |       create  config.ru
ruby_1  |       create  .gitignore
ruby_1  |       create  Gemfile
ruby_1  |          run  git init from "."
ruby_1  |       create  package.json
ruby_1  |       create  app
ruby_1  |       create  app/assets/config/manifest.js
ruby_1  |       create  app/assets/javascripts/application.js
ruby_1  |       create  app/assets/javascripts/cable.js
ruby_1  |       create  app/assets/stylesheets/application.css
ruby_1  |       create  app/channels/application_cable/channel.rb
ruby_1  |       create  app/channels/application_cable/connection.rb
ruby_1  |       create  app/controllers/application_controller.rb
ruby_1  |       create  app/helpers/application_helper.rb
ruby_1  |       create  app/jobs/application_job.rb
ruby_1  |       create  app/mailers/application_mailer.rb
ruby_1  |       create  app/models/application_record.rb
ruby_1  |       create  app/views/layouts/application.html.erb
ruby_1  |       create  app/views/layouts/mailer.html.erb
ruby_1  |       create  app/views/layouts/mailer.text.erb
ruby_1  |       create  app/assets/images/.keep
ruby_1  |       create  app/assets/javascripts/channels
ruby_1  |       create  app/assets/javascripts/channels/.keep
ruby_1  |       create  app/controllers/concerns/.keep
ruby_1  |       create  app/models/concerns/.keep
ruby_1  |       create  bin
ruby_1  |       create  bin/bundle
ruby_1  |       create  bin/rails
ruby_1  |       create  bin/rake
ruby_1  |       create  bin/setup
ruby_1  |       create  bin/update
ruby_1  |       create  bin/yarn
ruby_1  |       create  config
ruby_1  |       create  config/routes.rb
ruby_1  |       create  config/application.rb
ruby_1  |       create  config/environment.rb
ruby_1  |       create  config/cable.yml
ruby_1  |       create  config/puma.rb
ruby_1  |       create  config/spring.rb
ruby_1  |       create  config/storage.yml
ruby_1  |       create  config/environments
ruby_1  |       create  config/environments/development.rb
ruby_1  |       create  config/environments/production.rb
ruby_1  |       create  config/environments/test.rb
ruby_1  |       create  config/initializers
ruby_1  |       create  config/initializers/application_controller_renderer.rb
ruby_1  |       create  config/initializers/assets.rb
ruby_1  |       create  config/initializers/backtrace_silencers.rb
ruby_1  |       create  config/initializers/content_security_policy.rb
ruby_1  |       create  config/initializers/cookies_serializer.rb
ruby_1  |       create  config/initializers/cors.rb
ruby_1  |       create  config/initializers/filter_parameter_logging.rb
ruby_1  |       create  config/initializers/inflections.rb
ruby_1  |       create  config/initializers/mime_types.rb
ruby_1  |       create  config/initializers/new_framework_defaults_5_2.rb
ruby_1  |       create  config/initializers/wrap_parameters.rb
ruby_1  |       create  config/locales
ruby_1  |       create  config/locales/en.yml
ruby_1  |       create  config/master.key
ruby_1  |       append  .gitignore
ruby_1  |       create  config/boot.rb
ruby_1  |       create  config/database.yml
ruby_1  |       create  db
ruby_1  |       create  db/seeds.rb
ruby_1  |       create  lib
ruby_1  |       create  lib/tasks
ruby_1  |       create  lib/tasks/.keep
ruby_1  |       create  lib/assets
ruby_1  |       create  lib/assets/.keep
ruby_1  |       create  log
ruby_1  |       create  log/.keep
ruby_1  |       create  public
ruby_1  |       create  public/404.html
ruby_1  |       create  public/422.html
ruby_1  |       create  public/500.html
ruby_1  |       create  public/apple-touch-icon-precomposed.png
ruby_1  |       create  public/apple-touch-icon.png
ruby_1  |       create  public/favicon.ico
ruby_1  |       create  public/robots.txt
ruby_1  |       create  tmp
ruby_1  |       create  tmp/.keep
ruby_1  |       create  tmp/cache
ruby_1  |       create  tmp/cache/assets
ruby_1  |       create  vendor
ruby_1  |       create  vendor/.keep
ruby_1  |       create  test/fixtures
ruby_1  |       create  test/fixtures/.keep
ruby_1  |       create  test/fixtures/files
ruby_1  |       create  test/fixtures/files/.keep
ruby_1  |       create  test/controllers
ruby_1  |       create  test/controllers/.keep
ruby_1  |       create  test/mailers
ruby_1  |       create  test/mailers/.keep
ruby_1  |       create  test/models
ruby_1  |       create  test/models/.keep
ruby_1  |       create  test/helpers
ruby_1  |       create  test/helpers/.keep
ruby_1  |       create  test/integration
ruby_1  |       create  test/integration/.keep
ruby_1  |       create  test/test_helper.rb
ruby_1  |       create  test/system
ruby_1  |       create  test/system/.keep
ruby_1  |       create  test/application_system_test_case.rb
ruby_1  |       create  storage
ruby_1  |       create  storage/.keep
ruby_1  |       create  tmp/storage
ruby_1  |       create  tmp/storage/.keep
ruby_1  |       remove  config/initializers/cors.rb
ruby_1  |       remove  config/initializers/new_framework_defaults_5_2.rb
ruby_1  |          run  bundle install
ruby_1  | Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
ruby_1  | installing your bundle as root will break this application for all non-root
ruby_1  | users on this machine.
ruby_1  | The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
ruby_1  | Fetching gem metadata from https://rubygems.org/.........
ruby_1  | Fetching gem metadata from https://rubygems.org/.
ruby_1  | Resolving dependencies...
ruby_1  | Fetching rake 12.3.1
ruby_1  | Installing rake 12.3.1
ruby_1  | Using concurrent-ruby 1.0.5
ruby_1  | Using i18n 1.0.1
ruby_1  | Fetching minitest 5.11.3
ruby_1  | Installing minitest 5.11.3
ruby_1  | Using thread_safe 0.3.6
ruby_1  | Using tzinfo 1.2.5
ruby_1  | Using activesupport 5.2.0
ruby_1  | Using builder 3.2.3
ruby_1  | Using erubi 1.7.1
ruby_1  | Using mini_portile2 2.3.0
ruby_1  | Using nokogiri 1.8.3
ruby_1  | Using rails-dom-testing 2.0.3
ruby_1  | Using crass 1.0.4
ruby_1  | Using loofah 2.2.2
ruby_1  | Using rails-html-sanitizer 1.0.4
ruby_1  | Using actionview 5.2.0
ruby_1  | Using rack 2.0.5
ruby_1  | Using rack-test 1.0.0
ruby_1  | Using actionpack 5.2.0
ruby_1  | Using nio4r 2.3.1
ruby_1  | Using websocket-extensions 0.1.3
ruby_1  | Using websocket-driver 0.7.0
ruby_1  | Using actioncable 5.2.0
ruby_1  | Using globalid 0.4.1
ruby_1  | Using activejob 5.2.0
ruby_1  | Using mini_mime 1.0.0
ruby_1  | Using mail 2.7.0
ruby_1  | Using actionmailer 5.2.0
ruby_1  | Using activemodel 5.2.0
ruby_1  | Using arel 9.0.0
ruby_1  | Using activerecord 5.2.0
ruby_1  | Using mimemagic 0.3.2
ruby_1  | Using marcel 0.3.2
ruby_1  | Using activestorage 5.2.0
ruby_1  | Fetching public_suffix 3.0.2
ruby_1  | Installing public_suffix 3.0.2
ruby_1  | Fetching addressable 2.5.2
ruby_1  | Installing addressable 2.5.2
ruby_1  | Fetching io-like 0.3.0
ruby_1  | Installing io-like 0.3.0
ruby_1  | Fetching archive-zip 0.11.0
ruby_1  | Installing archive-zip 0.11.0
ruby_1  | Fetching bindex 0.5.0
ruby_1  | Installing bindex 0.5.0 with native extensions
ruby_1  | Fetching msgpack 1.2.4
ruby_1  | Installing msgpack 1.2.4 with native extensions
ruby_1  | Fetching bootsnap 1.3.0
ruby_1  | Installing bootsnap 1.3.0 with native extensions
ruby_1  | Using bundler 1.16.2
ruby_1  | Fetching byebug 10.0.2
ruby_1  | Installing byebug 10.0.2 with native extensions
ruby_1  | Fetching xpath 3.1.0
ruby_1  | Installing xpath 3.1.0
ruby_1  | Fetching capybara 3.2.1
ruby_1  | Installing capybara 3.2.1
ruby_1  | Fetching ffi 1.9.25
ruby_1  | Installing ffi 1.9.25 with native extensions
ruby_1  | Fetching childprocess 0.9.0
ruby_1  | Installing childprocess 0.9.0
ruby_1  | Fetching chromedriver-helper 1.2.0
ruby_1  | Installing chromedriver-helper 1.2.0
ruby_1  | Fetching execjs 2.7.0
ruby_1  | Installing execjs 2.7.0
ruby_1  | Fetching multi_json 1.13.1
ruby_1  | Installing multi_json 1.13.1
ruby_1  | Fetching jbuilder 2.7.0
ruby_1  | Installing jbuilder 2.7.0
ruby_1  | Fetching rb-fsevent 0.10.3
ruby_1  | Installing rb-fsevent 0.10.3
ruby_1  | Fetching rb-inotify 0.9.10
ruby_1  | Installing rb-inotify 0.9.10
ruby_1  | Fetching ruby_dep 1.5.0
ruby_1  | Installing ruby_dep 1.5.0
ruby_1  | Fetching listen 3.1.5
ruby_1  | Installing listen 3.1.5
ruby_1  | Using method_source 0.9.0
ruby_1  | Fetching mysql2 0.5.1
ruby_1  | Installing mysql2 0.5.1 with native extensions
ruby_1  | Fetching puma 3.11.4
ruby_1  | Installing puma 3.11.4 with native extensions
ruby_1  | Using thor 0.20.0
ruby_1  | Using railties 5.2.0
ruby_1  | Using sprockets 3.7.2
ruby_1  | Using sprockets-rails 3.2.1
ruby_1  | Using rails 5.2.0
ruby_1  | Fetching rubyzip 1.2.1
ruby_1  | Installing rubyzip 1.2.1
ruby_1  | Fetching sass-listen 4.0.0
ruby_1  | Installing sass-listen 4.0.0
ruby_1  | Fetching sass 3.5.6
ruby_1  | Installing sass 3.5.6
ruby_1  | Fetching tilt 2.0.8
ruby_1  | Installing tilt 2.0.8
ruby_1  | Fetching sass-rails 5.0.7
ruby_1  | Installing sass-rails 5.0.7
ruby_1  | Fetching selenium-webdriver 3.12.0
ruby_1  | Installing selenium-webdriver 3.12.0
ruby_1  | Fetching spring 2.0.2
ruby_1  | Installing spring 2.0.2
ruby_1  | Fetching spring-watcher-listen 2.0.1
ruby_1  | Installing spring-watcher-listen 2.0.1
ruby_1  | Fetching turbolinks-source 5.1.0
ruby_1  | Installing turbolinks-source 5.1.0
ruby_1  | Fetching turbolinks 5.1.1
ruby_1  | Installing turbolinks 5.1.1
ruby_1  | Fetching uglifier 4.1.12
ruby_1  | Installing uglifier 4.1.12
ruby_1  | Fetching web-console 3.6.2
ruby_1  | Installing web-console 3.6.2
ruby_1  | Bundle complete! 17 Gemfile dependencies, 75 gems now installed.
ruby_1  | Use `bundle info [gemname]` to see where a bundled gem is installed.
ruby_1  |          run  bundle exec spring binstub --all
ruby_1  | * bin/rake: spring inserted
ruby_1  | * bin/rails: spring inserted
ruby_1  | Install some gems manually
ruby_1  | Building native extensions. This could take a while...
ruby_1  | Successfully installed bindex-0.5.0
ruby_1  | 1 gem installed
ruby_1  | Install tzinfo-data gem
ruby_1  |   # Adds support for Capybara system testing and selenium driver
ruby_1  |   gem 'capybara', '>= 2.15', '< 4.0'
ruby_1  |   gem 'selenium-webdriver'
ruby_1  |   # Easy installation and use of chromedriver to run system tests with Chrome
ruby_1  |   gem 'chromedriver-helper'
ruby_1  | end
ruby_1  | 
ruby_1  | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
ruby_1  | gem 'tzinfo-data'
ruby_1  | gem 'unicorn'
ruby_1  | Bundle install
ruby_1  | Fetching gem metadata from https://rubygems.org/.........
ruby_1  | Fetching gem metadata from https://rubygems.org/.
ruby_1  | Resolving dependencies....
ruby_1  | Using rake 12.3.1
ruby_1  | Using concurrent-ruby 1.0.5
ruby_1  | Using i18n 1.0.1
ruby_1  | Using minitest 5.11.3
ruby_1  | Using thread_safe 0.3.6
ruby_1  | Using tzinfo 1.2.5
ruby_1  | Using activesupport 5.2.0
ruby_1  | Using builder 3.2.3
ruby_1  | Using erubi 1.7.1
ruby_1  | Using mini_portile2 2.3.0
ruby_1  | Using nokogiri 1.8.3
ruby_1  | Using rails-dom-testing 2.0.3
ruby_1  | Using crass 1.0.4
ruby_1  | Using loofah 2.2.2
ruby_1  | Using rails-html-sanitizer 1.0.4
ruby_1  | Using actionview 5.2.0
ruby_1  | Using rack 2.0.5
ruby_1  | Using rack-test 1.0.0
ruby_1  | Using actionpack 5.2.0
ruby_1  | Using nio4r 2.3.1
ruby_1  | Using websocket-extensions 0.1.3
ruby_1  | Using websocket-driver 0.7.0
ruby_1  | Using actioncable 5.2.0
ruby_1  | Using globalid 0.4.1
ruby_1  | Using activejob 5.2.0
ruby_1  | Using mini_mime 1.0.0
ruby_1  | Using mail 2.7.0
ruby_1  | Using actionmailer 5.2.0
ruby_1  | Using activemodel 5.2.0
ruby_1  | Using arel 9.0.0
ruby_1  | Using activerecord 5.2.0
ruby_1  | Using mimemagic 0.3.2
ruby_1  | Using marcel 0.3.2
ruby_1  | Using activestorage 5.2.0
ruby_1  | Using public_suffix 3.0.2
ruby_1  | Using addressable 2.5.2
ruby_1  | Using io-like 0.3.0
ruby_1  | Using archive-zip 0.11.0
ruby_1  | Using bindex 0.5.0
ruby_1  | Using msgpack 1.2.4
ruby_1  | Using bootsnap 1.3.0
ruby_1  | Using bundler 1.16.2
ruby_1  | Using byebug 10.0.2
ruby_1  | Using xpath 3.1.0
ruby_1  | Using capybara 3.2.1
ruby_1  | Using ffi 1.9.25
ruby_1  | Using childprocess 0.9.0
ruby_1  | Using chromedriver-helper 1.2.0
ruby_1  | Using execjs 2.7.0
ruby_1  | Using multi_json 1.13.1
ruby_1  | Using jbuilder 2.7.0
ruby_1  | Fetching kgio 2.11.2
ruby_1  | Installing kgio 2.11.2 with native extensions
ruby_1  | Using rb-fsevent 0.10.3
ruby_1  | Using rb-inotify 0.9.10
ruby_1  | Using ruby_dep 1.5.0
ruby_1  | Using listen 3.1.5
ruby_1  | Using method_source 0.9.0
ruby_1  | Using mysql2 0.5.1
ruby_1  | Using puma 3.11.4
ruby_1  | Using thor 0.20.0
ruby_1  | Using railties 5.2.0
ruby_1  | Using sprockets 3.7.2
ruby_1  | Using sprockets-rails 3.2.1
ruby_1  | Using rails 5.2.0
ruby_1  | Fetching raindrops 0.19.0
ruby_1  | Installing raindrops 0.19.0 with native extensions
ruby_1  | Using rubyzip 1.2.1
ruby_1  | Using sass-listen 4.0.0
ruby_1  | Using sass 3.5.6
ruby_1  | Using tilt 2.0.8
ruby_1  | Using sass-rails 5.0.7
ruby_1  | Using selenium-webdriver 3.12.0
ruby_1  | Using spring 2.0.2
ruby_1  | Using spring-watcher-listen 2.0.1
ruby_1  | Using turbolinks-source 5.1.0
ruby_1  | Using turbolinks 5.1.1
ruby_1  | Fetching tzinfo-data 1.2018.5
ruby_1  | Installing tzinfo-data 1.2018.5
ruby_1  | Using uglifier 4.1.12
ruby_1  | Fetching unicorn 5.4.0
ruby_1  | Installing unicorn 5.4.0 with native extensions
ruby_1  | Using web-console 3.6.2
ruby_1  | Bundle updated!
ruby_1  | Add AdminLTE with yarn
ruby_1  | yarn add v1.3.2
ruby_1  | info No lockfile found.
ruby_1  | [1/4] Resolving packages...
ruby_1  | warning admin-lte > jvectormap@1.2.2: jvectormap is not maintened since Aug 2015. You can use jvectormap-next or jqvmap instead.
ruby_1  | [2/4] Fetching packages...
ruby_1  | [3/4] Linking dependencies...
ruby_1  | [4/4] Building fresh packages...
ruby_1  | success Saved lockfile.
ruby_1  | success Saved 166 new dependencies.
ruby_1  | ├─ acorn-dynamic-import@3.0.0
ruby_1  | ├─ acorn-node@1.5.2
ruby_1  | ├─ acorn@5.7.1
ruby_1  | ├─ admin-lte@2.4.3
ruby_1  | ├─ almond@0.3.3
ruby_1  | ├─ array-filter@0.0.1
ruby_1  | ├─ array-map@0.0.0
ruby_1  | ├─ array-reduce@0.0.0
ruby_1  | ├─ asn1.js@4.10.1
ruby_1  | ├─ assert@1.4.1
ruby_1  | ├─ balanced-match@1.0.0
ruby_1  | ├─ base64-js@1.3.0
ruby_1  | ├─ bn.js@4.11.8
ruby_1  | ├─ bootstrap-colorpicker@2.5.2
ruby_1  | ├─ bootstrap-datepicker@1.8.0
ruby_1  | ├─ bootstrap-daterangepicker@2.1.30
ruby_1  | ├─ bootstrap-slider@9.10.0
ruby_1  | ├─ bootstrap-timepicker@0.5.2
ruby_1  | ├─ bootstrap@3.3.7
ruby_1  | ├─ brace-expansion@1.1.11
ruby_1  | ├─ brorand@1.1.0
ruby_1  | ├─ browser-pack@6.1.0
ruby_1  | ├─ browser-resolve@1.11.3
ruby_1  | ├─ browserify-aes@1.2.0
ruby_1  | ├─ browserify-cipher@1.0.1
ruby_1  | ├─ browserify-des@1.0.1
ruby_1  | ├─ browserify-rsa@4.0.1
ruby_1  | ├─ browserify-sign@4.0.4
ruby_1  | ├─ browserify-zlib@0.2.0
ruby_1  | ├─ browserify@16.2.2
ruby_1  | ├─ buffer-from@1.1.0
ruby_1  | ├─ buffer-xor@1.0.3
ruby_1  | ├─ buffer@5.1.0
ruby_1  | ├─ builtin-status-codes@3.0.0
ruby_1  | ├─ cached-path-relative@1.0.1
ruby_1  | ├─ charm@0.1.2
ruby_1  | ├─ chart.js@1.0.2
ruby_1  | ├─ cipher-base@1.0.4
ruby_1  | ├─ ckeditor@4.9.2
ruby_1  | ├─ classie@1.0.0
ruby_1  | ├─ combine-source-map@0.8.0
ruby_1  | ├─ concat-map@0.0.1
ruby_1  | ├─ concat-stream@1.6.2
ruby_1  | ├─ console-browserify@1.1.0
ruby_1  | ├─ constants-browserify@1.0.0
ruby_1  | ├─ convert-source-map@1.1.3
ruby_1  | ├─ core-util-is@1.0.2
ruby_1  | ├─ create-ecdh@4.0.3
ruby_1  | ├─ create-hash@1.2.0
ruby_1  | ├─ create-hmac@1.1.7
ruby_1  | ├─ crypto-browserify@3.12.0
ruby_1  | ├─ datatables.net-bs@1.10.19
ruby_1  | ├─ datatables.net@1.10.19
ruby_1  | ├─ date-now@0.1.4
ruby_1  | ├─ defined@1.0.0
ruby_1  | ├─ deps-sort@2.0.0
ruby_1  | ├─ des.js@1.0.0
ruby_1  | ├─ detective@5.1.0
ruby_1  | ├─ diffie-hellman@5.0.3
ruby_1  | ├─ domain-browser@1.2.0
ruby_1  | ├─ domhelper@0.9.1
ruby_1  | ├─ duplexer2@0.1.4
ruby_1  | ├─ elliptic@6.4.0
ruby_1  | ├─ eve-raphael@0.5.0
ruby_1  | ├─ events@2.1.0
ruby_1  | ├─ evp_bytestokey@1.0.3
ruby_1  | ├─ fastclick@1.0.6
ruby_1  | ├─ flot@0.8.0-alpha
ruby_1  | ├─ font-awesome@4.7.0
ruby_1  | ├─ fs.realpath@1.0.0
ruby_1  | ├─ fullcalendar@3.9.0
ruby_1  | ├─ function-bind@1.1.1
ruby_1  | ├─ get-assigned-identifiers@1.2.0
ruby_1  | ├─ glob@7.1.2
ruby_1  | ├─ has@1.0.3
ruby_1  | ├─ hash-base@3.0.4
ruby_1  | ├─ hash.js@1.1.4
ruby_1  | ├─ hmac-drbg@1.0.1
ruby_1  | ├─ htmlescape@1.1.1
ruby_1  | ├─ https-browserify@1.0.0
ruby_1  | ├─ ieee754@1.1.12
ruby_1  | ├─ inflight@1.0.6
ruby_1  | ├─ inherits@2.0.3
ruby_1  | ├─ inline-source-map@0.6.2
ruby_1  | ├─ inputmask@3.3.11
ruby_1  | ├─ insert-module-globals@7.2.0
ruby_1  | ├─ ion-rangeslider@2.2.0
ruby_1  | ├─ ionicons@3.0.0
ruby_1  | ├─ is-buffer@1.1.6
ruby_1  | ├─ isarray@2.0.4
ruby_1  | ├─ jquery-knob@1.2.11
ruby_1  | ├─ jquery-mousewheel@3.1.13
ruby_1  | ├─ jquery-sparkline@2.4.0
ruby_1  | ├─ jquery-ui@1.12.1
ruby_1  | ├─ jquery@3.3.1
ruby_1  | ├─ json-stable-stringify@0.0.1
ruby_1  | ├─ jsonify@0.0.0
ruby_1  | ├─ jsonparse@1.3.1
ruby_1  | ├─ JSONStream@1.3.3
ruby_1  | ├─ jvectormap@1.2.2
ruby_1  | ├─ labeled-stream-splicer@2.0.1
ruby_1  | ├─ lodash.memoize@3.0.4
ruby_1  | ├─ md5.js@1.3.4
ruby_1  | ├─ miller-rabin@4.0.1
ruby_1  | ├─ minimalistic-assert@1.0.1
ruby_1  | ├─ minimalistic-crypto-utils@1.0.1
ruby_1  | ├─ minimatch@3.0.4
ruby_1  | ├─ minimist@1.2.0
ruby_1  | ├─ mkdirp@0.5.1
ruby_1  | ├─ module-deps@6.1.0
ruby_1  | ├─ moment@2.22.2
ruby_1  | ├─ morris.js@0.5.0
ruby_1  | ├─ once@1.4.0
ruby_1  | ├─ os-browserify@0.3.0
ruby_1  | ├─ pace@0.0.4
ruby_1  | ├─ pako@1.0.6
ruby_1  | ├─ parents@1.0.1
ruby_1  | ├─ parse-asn1@5.1.1
ruby_1  | ├─ path-browserify@0.0.1
ruby_1  | ├─ path-is-absolute@1.0.1
ruby_1  | ├─ path-parse@1.0.5
ruby_1  | ├─ path-platform@0.11.15
ruby_1  | ├─ pbkdf2@3.0.16
ruby_1  | ├─ process-nextick-args@2.0.0
ruby_1  | ├─ process@0.11.10
ruby_1  | ├─ public-encrypt@4.0.2
ruby_1  | ├─ punycode@1.4.1
ruby_1  | ├─ querystring-es3@0.2.1
ruby_1  | ├─ querystring@0.2.0
ruby_1  | ├─ randombytes@2.0.6
ruby_1  | ├─ randomfill@1.0.4
ruby_1  | ├─ raphael@2.2.7
ruby_1  | ├─ read-only-stream@2.0.0
ruby_1  | ├─ readable-stream@2.3.6
ruby_1  | ├─ resolve@1.8.1
ruby_1  | ├─ ripemd160@2.0.2
ruby_1  | ├─ safe-buffer@5.1.2
ruby_1  | ├─ select2@4.0.5
ruby_1  | ├─ sha.js@2.4.11
ruby_1  | ├─ shasum@1.0.2
ruby_1  | ├─ shell-quote@1.6.1
ruby_1  | ├─ simple-concat@1.0.0
ruby_1  | ├─ slimscroll@0.9.1
ruby_1  | ├─ source-map@0.5.7
ruby_1  | ├─ stream-browserify@2.0.1
ruby_1  | ├─ stream-combiner2@1.1.1
ruby_1  | ├─ stream-http@2.8.3
ruby_1  | ├─ stream-splicer@2.0.0
ruby_1  | ├─ string_decoder@1.1.1
ruby_1  | ├─ subarg@1.0.0
ruby_1  | ├─ syntax-error@1.4.0
ruby_1  | ├─ through@2.3.8
ruby_1  | ├─ through2@2.0.3
ruby_1  | ├─ timers-browserify@1.4.2
ruby_1  | ├─ to-arraybuffer@1.0.1
ruby_1  | ├─ tty-browserify@0.0.1
ruby_1  | ├─ typedarray@0.0.6
ruby_1  | ├─ umd@3.0.3
ruby_1  | ├─ undeclared-identifiers@1.1.2
ruby_1  | ├─ url@0.11.0
ruby_1  | ├─ util-deprecate@1.0.2
ruby_1  | ├─ util-extend@1.0.3
ruby_1  | ├─ util@0.10.4
ruby_1  | ├─ vm-browserify@1.1.0
ruby_1  | ├─ wrappy@1.0.2
ruby_1  | └─ xtend@4.0.1
ruby_1  | Done in 43.67s.
ruby_1  | Create sample controller
ruby_1  |       create  app/controllers/sample_controller.rb
ruby_1  |        route  get 'sample/starter'
ruby_1  |       invoke  erb
ruby_1  |       create    app/views/sample
ruby_1  |       create    app/views/sample/starter.html.erb
ruby_1  |       invoke  test_unit
ruby_1  |       create    test/controllers/sample_controller_test.rb
ruby_1  |       invoke  helper
ruby_1  |       create    app/helpers/sample_helper.rb
ruby_1  |       invoke    test_unit
ruby_1  |       invoke  assets
ruby_1  |       invoke    js
ruby_1  |       create      app/assets/javascripts/sample.js
ruby_1  |       invoke    scss
ruby_1  |       create      app/assets/stylesheets/sample.scss
ruby_1  | Running via Spring preloader in process 1474
ruby_1  | Apply template config files
docker_ruby_1 exited with code 0
      138.19 real         0.70 user         0.28 sys
```

コンテナーが起動すると以下の作業が行われます。

* Railsプロジェクトを作成
* 必要なGemをインストール
* yarnでAdminLTEをインストール
* サンプルControllerを作成し、デフォルトパスに設定（`config/routes.rb`）
* Unicorn設定を追加（`config/unicorn.rb`）
* AdminLTEに必要なassetsをリンク（`application.css`と`application.js`）
* Mysqlデータベース設定を`config/database.yml`に追加

## Applicationを起動する

* Applicationイメージを作成

```shell:
> time docker-compose -f docker/docker-compose.dev.yml build
db uses an image, skipping
Building web
Step 1/9 : FROM ruby:2.4.2-alpine3.7
 ---> fcbe56f29e10
Step 2/9 : ENV LANG C.UTF-8
 ---> Using cache
 ---> afc67c2cfd90
Step 3/9 : ENV APP_HOME /app/rails-app
 ---> Running in 843e1dc8cc52
Removing intermediate container 843e1dc8cc52
 ---> 120f30d1685b
Step 4/9 : RUN mkdir -p $APP_HOME
 ---> Running in f2a96e393783
Removing intermediate container f2a96e393783
 ---> 7fa24d2fb6ae
Step 5/9 : WORKDIR $APP_HOME
Removing intermediate container 3dc548fb7519
 ---> 21adbf460a32
Step 6/9 : ADD rails-app/Gemfile* $APP_HOME/
 ---> 0c42f44731a4
Step 7/9 : RUN apk update &&     apk add --no-cache       build-base ruby-dev libressl-dev libc-dev       linux-headers mariadb-dev yarn &&     gem install --no-ri --no-rdoc bundler &&     bundle install &&     apk del --purge linux-headers build-base libc-dev libressl-dev ruby-dev &&     rm -rf /var/cache/apk/*
 ---> Running in 1c08b952c290
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-214-g519be0a2d1 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-207-gac61833f9b [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
OK: 9060 distinct packages available
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/37) Upgrading musl (1.1.18-r2 -> 1.1.18-r3)
(2/37) Installing binutils-libs (2.30-r1)
(3/37) Installing binutils (2.30-r1)
(4/37) Installing gmp (6.1.2-r1)
(5/37) Installing isl (0.18-r0)
(6/37) Installing libgomp (6.4.0-r5)
(7/37) Installing libatomic (6.4.0-r5)
(8/37) Installing libgcc (6.4.0-r5)
(9/37) Installing mpfr3 (3.1.5-r1)
(10/37) Installing mpc1 (1.0.3-r1)
(11/37) Installing libstdc++ (6.4.0-r5)
(12/37) Installing gcc (6.4.0-r5)
(13/37) Installing musl-dev (1.1.18-r3)
(14/37) Installing libc-dev (0.7.1-r0)
(15/37) Installing g++ (6.4.0-r5)
(16/37) Installing make (4.2.1-r0)
(17/37) Installing fortify-headers (0.9-r0)
(18/37) Installing build-base (0.5-r0)
(19/37) Upgrading musl-utils (1.1.18-r2 -> 1.1.18-r3)
(20/37) Installing linux-headers (4.4.6-r2)
(21/37) Installing mariadb-common (10.1.32-r0)
(22/37) Installing mariadb-client-libs (10.1.32-r0)
(23/37) Installing libaio (0.3.110-r1)
(24/37) Installing mariadb-libs (10.1.32-r0)
(25/37) Installing mariadb-dev (10.1.32-r0)
(26/37) Installing libgmpxx (6.1.2-r1)
(27/37) Installing gmp-dev (6.1.2-r1)
(28/37) Installing ruby-libs (2.4.4-r0)
(29/37) Installing ruby-dev (2.4.4-r0)
(30/37) Installing nodejs-npm (8.9.3-r1)
(31/37) Installing c-ares (1.13.0-r0)
(32/37) Installing libcrypto1.0 (1.0.2o-r0)
(33/37) Installing http-parser (2.7.1-r1)
(34/37) Installing libssl1.0 (1.0.2o-r0)
(35/37) Installing libuv (1.17.0-r0)
(36/37) Installing nodejs (8.9.3-r1)
(37/37) Installing yarn (1.3.2-r0)
Executing busybox-1.27.2-r6.trigger
OK: 478 MiB in 65 packages
Successfully installed bundler-1.16.2
1 gem installed
Fetching gem metadata from https://rubygems.org/.........
Fetching rake 12.3.1
Installing rake 12.3.1
Fetching concurrent-ruby 1.0.5
Installing concurrent-ruby 1.0.5
Fetching i18n 1.0.1
Installing i18n 1.0.1
Fetching minitest 5.11.3
Installing minitest 5.11.3
Fetching thread_safe 0.3.6
Installing thread_safe 0.3.6
Fetching tzinfo 1.2.5
Installing tzinfo 1.2.5
Fetching activesupport 5.2.0
Installing activesupport 5.2.0
Fetching builder 3.2.3
Installing builder 3.2.3
Fetching erubi 1.7.1
Installing erubi 1.7.1
Fetching mini_portile2 2.3.0
Installing mini_portile2 2.3.0
Fetching nokogiri 1.8.3
Installing nokogiri 1.8.3 with native extensions
Fetching rails-dom-testing 2.0.3
Installing rails-dom-testing 2.0.3
Fetching crass 1.0.4
Installing crass 1.0.4
Fetching loofah 2.2.2
Installing loofah 2.2.2
Fetching rails-html-sanitizer 1.0.4
Installing rails-html-sanitizer 1.0.4
Fetching actionview 5.2.0
Installing actionview 5.2.0
Fetching rack 2.0.5
Installing rack 2.0.5
Fetching rack-test 1.0.0
Installing rack-test 1.0.0
Fetching actionpack 5.2.0
Installing actionpack 5.2.0
Fetching nio4r 2.3.1
Installing nio4r 2.3.1 with native extensions
Fetching websocket-extensions 0.1.3
Installing websocket-extensions 0.1.3
Fetching websocket-driver 0.7.0
Installing websocket-driver 0.7.0 with native extensions
Fetching actioncable 5.2.0
Installing actioncable 5.2.0
Fetching globalid 0.4.1
Installing globalid 0.4.1
Fetching activejob 5.2.0
Installing activejob 5.2.0
Fetching mini_mime 1.0.0
Installing mini_mime 1.0.0
Fetching mail 2.7.0
Installing mail 2.7.0
Fetching actionmailer 5.2.0
Installing actionmailer 5.2.0
Fetching activemodel 5.2.0
Installing activemodel 5.2.0
Fetching arel 9.0.0
Installing arel 9.0.0
Fetching activerecord 5.2.0
Installing activerecord 5.2.0
Fetching mimemagic 0.3.2
Installing mimemagic 0.3.2
Fetching marcel 0.3.2
Installing marcel 0.3.2
Fetching activestorage 5.2.0
Installing activestorage 5.2.0
Fetching public_suffix 3.0.2
Installing public_suffix 3.0.2
Fetching addressable 2.5.2
Installing addressable 2.5.2
Fetching io-like 0.3.0
Installing io-like 0.3.0
Fetching archive-zip 0.11.0
Installing archive-zip 0.11.0
Fetching bindex 0.5.0
Installing bindex 0.5.0 with native extensions
Fetching msgpack 1.2.4
Installing msgpack 1.2.4 with native extensions
Fetching bootsnap 1.3.0
Installing bootsnap 1.3.0 with native extensions
Using bundler 1.16.2
Fetching byebug 10.0.2
Installing byebug 10.0.2 with native extensions
Fetching xpath 3.1.0
Installing xpath 3.1.0
Fetching capybara 3.2.1
Installing capybara 3.2.1
Fetching ffi 1.9.25
Installing ffi 1.9.25 with native extensions
Fetching childprocess 0.9.0
Installing childprocess 0.9.0
Fetching chromedriver-helper 1.2.0
Installing chromedriver-helper 1.2.0
Fetching execjs 2.7.0
Installing execjs 2.7.0
Fetching multi_json 1.13.1
Installing multi_json 1.13.1
Fetching jbuilder 2.7.0
Installing jbuilder 2.7.0
Fetching kgio 2.11.2
Installing kgio 2.11.2 with native extensions
Fetching rb-fsevent 0.10.3
Installing rb-fsevent 0.10.3
Fetching rb-inotify 0.9.10
Installing rb-inotify 0.9.10
Fetching ruby_dep 1.5.0
Installing ruby_dep 1.5.0
Fetching listen 3.1.5
Installing listen 3.1.5
Fetching method_source 0.9.0
Installing method_source 0.9.0
Fetching mysql2 0.5.1
Installing mysql2 0.5.1 with native extensions
Fetching puma 3.11.4
Installing puma 3.11.4 with native extensions
Fetching thor 0.20.0
Installing thor 0.20.0
Fetching railties 5.2.0
Installing railties 5.2.0
Fetching sprockets 3.7.2
Installing sprockets 3.7.2
Fetching sprockets-rails 3.2.1
Installing sprockets-rails 3.2.1
Fetching rails 5.2.0
Installing rails 5.2.0
Fetching raindrops 0.19.0
Installing raindrops 0.19.0 with native extensions
Fetching rubyzip 1.2.1
Installing rubyzip 1.2.1
Fetching sass-listen 4.0.0
Installing sass-listen 4.0.0
Fetching sass 3.5.6
Installing sass 3.5.6
Fetching tilt 2.0.8
Installing tilt 2.0.8
Fetching sass-rails 5.0.7
Installing sass-rails 5.0.7
Fetching selenium-webdriver 3.12.0
Installing selenium-webdriver 3.12.0
Fetching spring 2.0.2
Installing spring 2.0.2
Fetching spring-watcher-listen 2.0.1
Installing spring-watcher-listen 2.0.1
Fetching turbolinks-source 5.1.0
Installing turbolinks-source 5.1.0
Fetching turbolinks 5.1.1
Installing turbolinks 5.1.1
Fetching tzinfo-data 1.2018.5
Installing tzinfo-data 1.2018.5
Fetching uglifier 4.1.12
Installing uglifier 4.1.12
Fetching unicorn 5.4.0
Installing unicorn 5.4.0 with native extensions
Fetching web-console 3.6.2
Installing web-console 3.6.2
Bundle complete! 18 Gemfile dependencies, 79 gems now installed.
Bundled gems are installed into `/usr/local/bundle`
World updated, but the following packages are not removed due to:
  libressl-dev: mariadb-dev .ruby-rundeps

(1/20) Purging build-base (0.5-r0)
(2/20) Purging g++ (6.4.0-r5)
(3/20) Purging gcc (6.4.0-r5)
(4/20) Purging binutils (2.30-r1)
(5/20) Purging libatomic (6.4.0-r5)
(6/20) Purging libgomp (6.4.0-r5)
(7/20) Purging make (4.2.1-r0)
(8/20) Purging libc-dev (0.7.1-r0)
(9/20) Purging musl-dev (1.1.18-r3)
(10/20) Purging fortify-headers (0.9-r0)
(11/20) Purging linux-headers (4.4.6-r2)
(12/20) Purging ruby-dev (2.4.4-r0)
(13/20) Purging gmp-dev (6.1.2-r1)
(14/20) Purging libgmpxx (6.1.2-r1)
(15/20) Purging ruby-libs (2.4.4-r0)
(16/20) Purging binutils-libs (2.30-r1)
(17/20) Purging mpc1 (1.0.3-r1)
(18/20) Purging mpfr3 (3.1.5-r1)
(19/20) Purging isl (0.18-r0)
(20/20) Purging gmp (6.1.2-r1)
Executing busybox-1.27.2-r6.trigger
OK: 304 MiB in 45 packages
Removing intermediate container 1c08b952c290
 ---> a95049f7843c
Step 8/9 : ADD . $APP_HOME
 ---> cd532053126b
Step 9/9 : EXPOSE 3000
 ---> Running in a670cbe89551
Removing intermediate container a670cbe89551
 ---> 69cb437fddc9
Successfully built 69cb437fddc9
Successfully tagged rails-app:0.0.1
      176.36 real         4.06 user         1.75 sys
```

* Applicationコンテナーを起動

```shell:
> docker-compose -f docker/docker-compose.dev.yml up
Recreating docker_db_1 ... done
Recreating docker_web_1 ... done
Attaching to docker_db_1, docker_web_1
db_1   | Initializing database
・・・ログ省略・・・
```

> 初回起動時にデータベースの初期化で時間が掛かり、Railsコンテナーが接続できないと異常終了する可能性がります。その場合、もう一度上記のコマンドで再起動してください。

今回developmentモードだけ用意していますが、SQLiteではなくMySQLコンテナーのデータベースにしています。

`http://localhost:3000`でアプリケーションが開けます。

<img width="1203" alt="Rails-AdminLTE-docker.png" src="https://qiita-image-store.s3.amazonaws.com/0/260796/2cb731a0-2cf6-037b-7207-d177c5cc8de3.png">

サクッとできました :)