{"id":8808,"date":"2019-12-23T21:36:02","date_gmt":"2019-12-23T12:36:02","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=8808"},"modified":"2023-05-27T18:44:27","modified_gmt":"2023-05-27T09:44:27","slug":"%e3%80%90docker%e3%80%91ruby-on-rails%e3%81%ae%e3%82%b3%e3%83%b3%e3%83%86%e3%83%8a%e3%82%92%e4%bd%9c%e6%88%90%e3%81%99%e3%82%8b%e3%80%82","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=8808","title":{"rendered":"\u3010Docker\u3011Ruby on Rails\u306e\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u6210\u3057\u3066\u8d77\u52d5\u3059\u308b\u307e\u3067\u3002"},"content":{"rendered":"<p>Docker\u3067Rails\u3092\u4f7f\u3046\u305f\u3081\u306b\u306f\u4e0b\u8a18\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u7528\u610f\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>Dockerfile<\/li>\n<li>Gemfile<\/li>\n<li>Gemfile.lock<\/li>\n<li>docker-compose.yml<\/li>\n<\/ul>\n<h2>Dockerfile<\/h2>\n<p>Rails\u306e\u5b9f\u884c\u74b0\u5883\u7528\u306e\u30a4\u30e1\u30fc\u30b8\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306e\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">FROM ruby:\u30d0\u30fc\u30b8\u30e7\u30f3\uff082.4.5\u7b49\uff09\r\nRUN apt-get update -qq &amp;&amp; apt-get install -y build-essential nodejs\r\nRUN mkdir \/app\r\nWORKDIR \/app\r\nCOPY Gemfile \/app\/Gemfile\r\nCOPY Gemfile.lock \/app\/Gemfile.lock\r\nRUN bundle install\r\nCOPY . \/app<\/pre>\n<h4>FROM ruby:\u30d0\u30fc\u30b8\u30e7\u30f3\uff082.4.5\u7b49\uff09<\/h4>\n<p>\u6307\u5b9a\u3055\u308c\u305fRuby\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u30a4\u30e1\u30fc\u30b8\u3068\u3057\u307e\u3059\u3002\u300cruby\u300d\u306fRuby\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u6307\u3057\u307e\u3059\u3002\uff08\u4ed6\u306b\u3082\u69d8\u3005\u306a\u30bf\u30b0\u304c\u3042\u308a\u307e\u3059\u3002\uff09\u3001\u3053\u306e\u6642\u70b9\u3067\u30b3\u30f3\u30c6\u30ca\u306f\u8d77\u52d5\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>RUN apt-get update -qq &amp;&amp; apt-get install -y build-essential nodejs<\/h4>\n<p>\u30b3\u30f3\u30c6\u30ca\u5185\u3067\u5b9f\u884c\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002build-essential\u3068Node.js\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002\uff08Rails\u306e\u52d5\u4f5c\u306b\u5fc5\u8981\uff09<\/p>\n<h4>RUN mkdir \/app\u3000\u53ca\u3073 WORKDIR \/app<\/h4>\n<p>\u30b3\u30f3\u30c6\u30ca\u306b\u300c\/app\u300d(Rails\u3092\u69cb\u7bc9\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea)\u3068\u3044\u3046\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u308a\u4f5c\u696d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3068\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h4>COPY Gemfile \/app\/Gemfile\u3000\u53ca\u3073 COPY Gemfile.lock \/app\/Gemfile.lock\u3000\u53ca\u3073\u3000 RUN bundle install<\/h4>\n<p>Gemfile\u3068Gemfile.lock\u3092\u300c\/app\u300d\u306b\u30b3\u30d4\u30fc\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<h4>COPY . \/app<\/h4>\n<p>Dockerfile\u304c\u7f6e\u3044\u3066\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u300c\/app\u300d\u306b\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002<span style=\"color: #ff0000;\"><strong>Rails\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5b9f\u884c\u306b\u5fc5\u8981\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u5168\u3066\u30b3\u30f3\u30c6\u30ca\u306e\u4e2d\u306b\u542b\u3081\u308b\u305f\u3081\u306b\u8a18\u8f09<\/strong><\/span>\u3057\u307e\u3059\u3002\u306a\u306e\u3067\u3001Dockerfile\u304c\u914d\u7f6e\u3055\u308c\u3066\u3044\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u306f\u4f59\u8a08\u306a\u30d5\u30a1\u30a4\u30eb\u306f\u914d\u7f6e\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>Gemfile<\/h2>\n<pre class=\"lang:default decode:true\">source 'https:\/\/rubygems.org'\r\ngem 'rails', '5.0.0.1'<\/pre>\n<h3>source 'https:\/\/rubygems.org'<\/h3>\n<p>Gem\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u5143\u306eURL\u3092\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n<h3>gem 'rails', '5.0.0.1'<\/h3>\n<p>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308bRails\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<h2>Gemfile.lock<\/h2>\n<p>\u4f55\u3082\u8a18\u8ff0\u3057\u306a\u304f\u3066\u3082\u5927\u4e08\u592b\u3067\u3059\u3002<\/p>\n<h2>docker-compose.yml<\/h2>\n<pre class=\"lang:default decode:true\">version: '3'\r\nservices:\r\n  web:\r\n    build: .\r\n    command: bundle exec rails s -p 3000 -b '0.0.0.0'\r\n    volumes:\r\n      - .:\/app\r\n    ports:\r\n      - 3000:3000\r\n    depends_on:\r\n      - db\r\n    tty: true\r\n    stdin_open: true\r\n  db:\r\n    image: mysql:5.7\r\n    volumes:\r\n      - db-volume:\/var\/lib\/mysql\r\n    environment:\r\n      MYSQL_ROOT_PASSWORD: XXX(\u4efb\u610f\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\uff09\r\nvolumes:\r\n  db-volume:<\/pre>\n<h3>\u5404\u30b3\u30f3\u30c6\u30ca\u306e\u901a\u4fe1<\/h3>\n<p>\u30b3\u30f3\u30c6\u30ca\u306e\u30b5\u30fc\u30d3\u30b9\u540d\uff08\u300cweb:\u300d\u3084\u300cdb:\u300d\u3067\u6307\u5b9a\u3057\u305f\u540d\u524d\uff09\u3067\u30b3\u30f3\u30c6\u30ca\u9593\u901a\u4fe1\u3092\u884c\u3046\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<h3>web:<\/h3>\n<p>Rails\u306e\u30b3\u30f3\u30c6\u30ca\u306e\u5b9a\u7fa9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>build.<\/h4>\n<p>Dockerfile\u3092\u8aad\u307f\u8fbc\u3093\u3067\u30a4\u30e1\u30fc\u30b8\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h4>command: bundle exec rails s -p 3000 -b '0.0.0.0'<\/h4>\n<p>\u30b3\u30f3\u30c6\u30ca\u3092\u8d77\u52d5\u3057\u305f\u969b\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u5b9f\u884c\u3055\u308c\u308b\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002\u30b3\u30de\u30f3\u30c9\u5185\u5bb9\u3068\u3057\u3066\u306fRails\u306eWeb\u30b5\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3059\u308b\u30b3\u30de\u30f3\u30c9\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<span style=\"color: #ff0000;\"><strong>\u300cbundle exec rails\u300d<\/strong><\/span>\u3068\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067Gemfile\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305fRails\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u300c-p\u300d\u306f\u30dd\u30fc\u30c8\u756a\u53f7\u3001\u300c-b\u300d\u306fbind\u3059\u308bIP\u30a2\u30c9\u30ec\u30b9\u3092\u793a\u3057\u307e\u3059\u3002\u300c0.0.0.0\u300d\u3068\u6307\u5b9a\u3057\u305f\u5834\u5408\u306f\u30b3\u30f3\u30c6\u30ca\u304c\u6301\u3063\u3066\u3044\u308b\u5168\u3066\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u306b3000\u756a\u30dd\u30fc\u30c8\u3078\u306e\u901a\u4fe1\u304c\u304d\u305f\u5834\u5408\u306fRails\u30b5\u30fc\u30d0\u304c\u5fdc\u7b54\u3057\u307e\u3059\u3002bind\u3068\u304b\u306e\u610f\u5473\u306b\u3064\u3044\u3066\u306f\u4e0b\u8a18\u306e\u8a18\u4e8b\u3067\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"cAVoRI3HLS\"><p><a href=\"http:\/\/www.code-magagine.com\/?p=8814\">\u3010\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3011\u300cbind\u30a2\u30c9\u30ec\u30b9\u300d\u3084\u300c0.0.0.0\u300d\u3068\u306f\uff1f<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"http:\/\/www.code-magagine.com\/?p=8814&#038;embed=true#?secret=cAVoRI3HLS\" data-secret=\"cAVoRI3HLS\" width=\"500\" height=\"282\" title=\"&#8220;\u3010\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3011\u300cbind\u30a2\u30c9\u30ec\u30b9\u300d\u3084\u300c0.0.0.0\u300d\u3068\u306f\uff1f&#8221; &#8212; \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30de\u30ac\u30b8\u30f3\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<h4>volumes: - .:\/app<\/h4>\n<p>PC\u4e0a\u306edocker-compose.yml\u304c\u914d\u7f6e\u3055\u308c\u3066\u3044\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u30b3\u30f3\u30c6\u30ca\u4e0a\u306e\u300c\/app\u300d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u5171\u6709\u3055\u305b\u307e\u3059\u3002\u3053\u306e\u8a2d\u5b9a\u306b\u3088\u308a<span style=\"color: #ff0000;\"><strong>PC\u4e0a\u3067\u4fee\u6b63\u3057\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304c\u30b3\u30f3\u30c6\u30ca\u4e0a\u306b\u53cd\u6620\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/strong><\/span><\/p>\n<h4>ports: - 3000:3000<\/h4>\n<p>\u30b3\u30f3\u30c6\u30ca\u306e\u5916\u90e8\u306b3000\u756a\u30dd\u30fc\u30c8\u3092\u516c\u958b\u3059\u308b\u305f\u3081\u306e\u8a2d\u5b9a\u3067\u3059\u3002\u30b3\u30f3\u30c6\u30ca\u3067\u52d5\u4f5c\u3057\u3066\u3044\u308bRails\u306b\u81ea\u7aef\u672b\u306ePC\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306e\u8a2d\u5b9a\u3067\u3059\u3002<\/p>\n<h4>depends_on: - db<\/h4>\n<p>Rails\u304c\u8d77\u52d5\u3059\u308b\u524d\u306b\u300cdb\uff08\u3059\u306a\u308f\u3061MySQL\uff09\u300d\u304c\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<h4>tty: true \u53ca\u3073 stdin_open: true<\/h4>\n<p>Rails\u3067pray\u3092\u4f7f\u7528\u3057\u3066\u30c7\u30d0\u30c3\u30b0\u3059\u308b\u969b\u306e\u8a2d\u5b9a\u3067\u3059\u3002<\/p>\n<h3>db:<\/h3>\n<p>MySQL\u30b5\u30fc\u30d0\u306e\u30b3\u30f3\u30c6\u30ca\u5b9a\u7fa9\u306b\u306a\u308a\u307e\u3059\u3002MySQL\u306e\u30db\u30b9\u30c8\u540d\u306b\u3082\u300cdb\u300d\u3068\u8a18\u8f09\u3057\u30b3\u30f3\u30c6\u30ca\u306e\u30b5\u30fc\u30d3\u30b9\u540d\u304c\u4f7f\u308f\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>\u300cvolumes: - db-volume:\/var\/lib\/mysql\u300d\u3000\u53ca\u3073\u3000\u300cvolumes:<span class=\"Apple-converted-space\">\u00a0 <\/span>db-volume:\u300d<\/h4>\n<p>PC\u4e0a\u306b\u300cdb-volume\u300d\u3068\u3044\u3046\u540d\u524d\u3067\u30dc\u30ea\u30e5\u30fc\u30e0\uff08\u30c7\u30fc\u30bf\u4fdd\u5b58\u9818\u57df\uff09\u3092\u4f5c\u6210\u3057\u3001\u3053\u308c\u3092\u30b3\u30f3\u30c6\u30ca\u4e0a\u306e\u300c\/var\/lib\/mysql\u300d\u3068\u3044\u3046\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u30de\u30a6\u30f3\u30c8\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a<span style=\"color: #ff0000;\"><strong>\u30b3\u30f3\u30c6\u30ca\u4e0a\u306b\u30c7\u30fc\u30bf\u304c\u4fdd\u5b58\u3055\u308c\u3066\u3057\u307e\u3046\u306e\u3092\u9632\u304e\u30b3\u30f3\u30c6\u30ca\u3092\u524a\u9664\u3057\u305f\u5834\u5408\u3067\u3082\u30c7\u30fc\u30bf\u3082\u5408\u308f\u305b\u3066\u524a\u9664\u3055\u308c\u3066\u3057\u307e\u3046\u3068\u3044\u3046\u3053\u3068\u3092\u9632\u304e\u307e\u3059\u3002<\/strong><\/span>\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u308a\u76f4\u3057\u305f\u3068\u3057\u3066\u3082\u30c7\u30fc\u30bf\u304c\u4fdd\u6301\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>environment: MYSQL_ROOT_PASSWORD: password<\/h4>\n<p>\u30b3\u30f3\u30c6\u30ca\u5185\u306e\u74b0\u5883\u5909\u6570\u306b\u306a\u308a\u307e\u3059\u3002MySQL\u306eroot\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a2d\u5b9a\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>Rais\u3092\u65b0\u898f\u4f5c\u6210\u3059\u308b\u30b3\u30de\u30f3\u30c9<\/h2>\n<h3>Rails\u30a2\u30d7\u30ea\u306e\u4f5c\u6210<\/h3>\n<p>\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u3066Rails\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">docker-compose run web rails new . --force --database=mysql<\/pre>\n<h4>docker-compose run web<\/h4>\n<p>docker-compose.yml\u30d5\u30a1\u30a4\u30eb\u306b\u8a18\u8ff0\u3057\u305fweb\u30b3\u30f3\u30c6\u30ca\u4e0a\u3067\u5f8c\u308d\u306b\u7d9a\u304fRails\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306e\u30b3\u30de\u30f3\u30c9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>.<\/h4>\n<p>\/app\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u3066Rails\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<h4>--force<\/h4>\n<p>\u65e2\u5b58\u30d5\u30a1\u30a4\u30eb\u3092\u4e0a\u66f8\u304d\u3059\u308b\u8a2d\u5b9a\u3067\u3059\u3002Gemfile\u3084Gemfile.lock\u7b49\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4e0a\u66f8\u304d\u3057\u3066\u4f7f\u3046\u305f\u3081\u306b\u5fc5\u8981\u306a\u8a2d\u5b9a\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>--database=mysql<\/h4>\n<p>Rails\u30a2\u30d7\u30ea\u3067MySQL\u3092\u4f7f\u3046\u305f\u3081\u306e\u8a2d\u5b9a\u3067\u3059\u3002<\/p>\n<h3>\u4f5c\u6210\u3057\u305fRails\u30a2\u30d7\u30ea\u3092\u30b3\u30f3\u30c6\u30ca\u5185\u306b\u53d6\u308a\u8fbc\u3080<\/h3>\n<p>\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3067\u518d\u5ea6Dockerfile\u304b\u3089\u30a4\u30e1\u30fc\u30b8\u3092\u30d3\u30eb\u30c9\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">docker-compose build<\/pre>\n<h2>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a<\/h2>\n<p>\u300cconfig\/database.yml\u300d\u3092\u958b\u304d\u3001root\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3068\u30db\u30b9\u30c8\u540d\u3092\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">default: &amp;default\r\n  adapter: mysql2\r\n  encoding: utf8\r\n  pool: 5\r\n  username: root\r\n  password: docker-compose.yml\u3067\u6c7a\u3081\u305f\u4efb\u610f\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3000\u2605\r\n  host: db\u3000\u2605<\/pre>\n<p>\u30d1\u30b9\u30ef\u30fc\u30c9\u306fDB\u30b3\u30f3\u30c6\u30ca\u306e\u74b0\u5883\u5909\u6570\u3067\u6307\u5b9a\u3057\u305f\u300cMYSQL_ROOT_PASSWORD\u300d\u306b\u5408\u308f\u305b\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30b3\u30f3\u30c6\u30ca\u3092\u8d77\u52d5\u3059\u308b\u3002<\/h2>\n<p>\u73fe\u5728\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u3042\u308bdocker-compose.yml\u306b\u57fa\u3065\u3044\u3066\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002web\u30b3\u30f3\u30c6\u30ca\u3082db\u30b3\u30f3\u30c6\u30ca\u3082\u3069\u3061\u3089\u3082\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">docker-compose up -d<\/pre>\n<p>\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3067\u30b3\u30f3\u30c6\u30ca\u304c\u6b63\u5e38\u306b\u8d77\u52d5\u3057\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">docker-compose ps<\/pre>\n<h3>Rails\u306eDB\u3092\u4f5c\u6210<\/h3>\n<p>DB\u30b3\u30f3\u30c6\u30ca\u306f\u4f5c\u6210\u3055\u308c\u307e\u3057\u305f\u304c\u3001Rails\u306eDB\u306f\u307e\u3060\u4f5c\u6210\u3055\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">docker-compose run web bundle exec rake db:create<\/pre>\n<h4>bundle exec rake\u00a0db:create<\/h4>\n<p>Rails\u74b0\u5883\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308brake\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<span style=\"color: #ff0000;\"><strong>\u300crake\u00a0db:create\u300d<\/strong><\/span>\u306b\u3066Rails\u3067\u4f7f\u7528\u3059\u308bDB\u3092MySQL\u4e0a\u306b\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<h2>Web\u30b3\u30f3\u30c6\u30ca\u4e0a\u306eRails\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3002<\/h2>\n<p>\u4e0b\u8a18\u306e\u3088\u3046\u306b\u6253\u3066\u3070Web\u30b3\u30f3\u30c6\u30ca\u4e0a\u306b\u914d\u7f6e\u3057\u305fRails\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">http:\/\/localhost:3000\/<\/pre>\n<p>\u306a\u304a\u3001\u30ed\u30fc\u30ab\u30eb\u306e\u30db\u30b9\u30c8PC\u3067\u3059\u3067\u306b3000\u756a\u30dd\u30fc\u30c8\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u30a2\u30d7\u30ea\u304c\u3042\u308b\u5834\u5408\u306f\u30dd\u30fc\u30c8\u30d5\u30a9\u30ef\u30fc\u30c7\u30a3\u30f3\u30b0\u3055\u308c\u305a\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u306e\u3067\u30dd\u30fc\u30c8\u3092\u958b\u653e\u3057\u3066\u304b\u3089\u5b9f\u884c\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-8838\" src=\"http:\/\/www.code-magagine.com\/wp-content\/uploads\/2019\/12\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2019-12-24-22.01.05.png\" alt=\"\" width=\"1866\" height=\"1202\" srcset=\"http:\/\/www.code-magagine.com\/wp-content\/uploads\/2019\/12\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2019-12-24-22.01.05.png 1866w, http:\/\/www.code-magagine.com\/wp-content\/uploads\/2019\/12\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2019-12-24-22.01.05-300x193.png 300w, http:\/\/www.code-magagine.com\/wp-content\/uploads\/2019\/12\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2019-12-24-22.01.05-768x495.png 768w, http:\/\/www.code-magagine.com\/wp-content\/uploads\/2019\/12\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2019-12-24-22.01.05-1024x660.png 1024w\" sizes=\"(max-width: 1866px) 100vw, 1866px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"Docker\u3067Rails\u3092\u4f7f\u3046\u305f\u3081\u306b\u306f\u4e0b\u8a18\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u7528\u610f\u3057\u307e\u3059\u3002 Dockerfile Gemfile Gemfile.lock docker-compose.yml Dockerfile Rails\u306e\u5b9f\u884c\u74b0\u5883\u7528\u306e\u30a4\u30e1 [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[63,36],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/8808"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8808"}],"version-history":[{"count":15,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/8808\/revisions"}],"predecessor-version":[{"id":20177,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/8808\/revisions\/20177"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8808"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}