thanks : Dockerで開発環境を作る
if you don't have Docker for Mac, you need bellow
- virtual box
- ~> 5.0.16
- docker tool box
- ~> 1.10.3
I suggest you to install Docker for Mac.
Because you are released from docker-machine
command by Docker for Mac.
$ docker-compose up
and access http://localhost:3000
$ docker-machine start dev
$ eval "$(docker-machine env dev)"
$ docker-compose up
and access http://192.168.99.100:3000
$ docker-compose stop
$ docker-compose stop
$ docker-machine stop dev
$ docker-compose run web bundle exec rake spec
after editing Gemfile
$ docker-compose build
if you have Docker for Mac, you don't need this step.
$ docker-machine create --virtualbox-disk-size "30000" -d virtualbox dev
$ eval "$(docker-machine env dev)"
$ cd [repo-root]
$ git clone [your rail app repo] app
$ cd base-image
$ docker build -t my-dockerhub-repository/centos6-ruby2.3.0:latest .
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> bd9676237c92 3 minutes ago 887.3 MB
centos centos6 cf2c3ece5e41 21 hours ago 194.6 MB
$ docker tag bd9676237c92 my-dockerhub-repository/centos6-ruby2.3.0:latest
$ cd ..
$ docker-compose run web bundle exec rake db:create db:migrate db:seed RAILS_ENV=development
$ docker-compose run web bundle exec rake db:create db:migrate RAILS_ENV=test
$ docker-compose up
and access http://localhost:3000
and access http://192.168.99.100:3000
\(^o^)/