{"id":8215,"date":"2015-11-09T12:15:49","date_gmt":"2015-11-09T10:15:49","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=8215"},"modified":"2015-12-16T10:49:42","modified_gmt":"2015-12-16T08:49:42","slug":"deploying-docker-rails-app","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/","title":{"rendered":"Deploying Your Docker Rails App"},"content":{"rendered":"<p>In a previous article by Marko Locher, we learned how to run a <a href=\"http:\/\/www.webcodegeeks.com\/web-development\/running-rails-development-environment-docker\/\">Rails development environment in Docker<\/a>. Marko also wrote about how to <a href=\"http:\/\/www.webcodegeeks.com\/web-development\/testing-rails-application-docker\/\">test a Rails app with Docker<\/a>. So assuming we have our dev environment set up, our app is tested (and the tests are passing), we\u2019re ready to think about deploying our application to production. If you haven\u2019t yet, I recommend reading those two articles first to get a good overview of how Docker works.<\/p>\n<p>In this article, we\u2019ll talk about how to deploy our Docker container quickly and simply to Heroku. Once we\u2019re done with that, we\u2019ll investigate how to build a production Docker image using a minimal base which doesn\u2019t include development dependencies. Then we\u2019ll push our image to the Docker Hub and deploy it to a server.<\/p>\n<h2>Simple Rails Docker on Heroku<\/h2>\n<p>Most Rails developers are familiar with Heroku and have probably at one time or another deployed an app to it, even if it was just a personal blog or something you were playing around with. I\u2019ve used Heroku both for personal projects and also for larger client projects with lots of success. Heroku isn\u2019t just for Rails apps\u2026 you can deploy PHP apps, NodeJS apps, Elixir apps, and as of earlier this year you can <a href=\"https:\/\/devcenter.heroku.com\/articles\/docker\">even deploy Docker containers<\/a>.<\/p>\n<h3>Getting set up<\/h3>\n<p>The first thing you\u2019ll need to do is install the heroku-docker plugin for the Heroku toolbelt: <code>heroku plugins:install heroku-docker<\/code><\/p>\n<p>Once you\u2019ve set up a normal Rails app (either new or existing), you\u2019ll need to add an additional file to the root called <code>app.js<\/code>.<\/p>\n<pre class=\" brush:php\">{\r\n  \"name\": \"My App Name\",\r\n  \"description\": \"An example app.json for heroku-docker\",\r\n  \"image\": \"heroku\/ruby\",\r\n  \"addons\": [\r\n    \"heroku-postgresql\"\r\n  ]\r\n}<\/pre>\n<p>Heroku has a number of different images you can use for each of the different languages they support. Next we\u2019ll create a file called <code>Procfile<\/code> which Heroku uses to help start our app.<\/p>\n<pre class=\" brush:php\">web: bundle exec puma -C config\/puma.rb<\/pre>\n<p>The next step is to generate a new <a href=\"http:\/\/blog.codeship.com\/what-is-a-dockerfile\/\">Dockerfile<\/a>. We can use Heroku\u2019s toolbelt for this and by running the command <code>heroku docker:init<\/code> we\u2019ll get both a <code>Dockerfile<\/code> file and a <code>docker-compose.yml<\/code> file.<\/p>\n<p>The Dockerfile is extremely small, only pulling from the <code>heroku\/ruby<\/code> image:<\/p>\n<pre class=\" brush:php\">FROM heroku\/ruby<\/pre>\n<p>The <code>docker-compose.yml<\/code> file is a little more involved and sets up two linked images (one for Ruby\/Rails and one for Postgres):<\/p>\n<pre class=\" brush:php\">web:\r\n  build: .\r\n  command: 'bash -c ''bundle exec puma -C config\/puma.rb'''\r\n  working_dir: \/app\/user\r\n  environment:\r\n    PORT: 8080\r\n    DATABASE_URL: 'postgres:\/\/postgres:@herokuPostgresql:5432\/postgres'\r\n  ports:\r\n    - '8080:8080'\r\n  links:\r\n    - herokuPostgresql\r\nshell:\r\n  build: .\r\n  command: bash\r\n  working_dir: \/app\/user\r\n  environment:\r\n    PORT: 8080\r\n    DATABASE_URL: 'postgres:\/\/postgres:@herokuPostgresql:5432\/postgres'\r\n  ports:\r\n    - '8080:8080'\r\n  links:\r\n    - herokuPostgresql\r\n  volumes:\r\n    - '.:\/app\/user'\r\nherokuPostgresql:\r\n  image: postgres<\/pre>\n<p>One great benefit of Heroku Docker is that not only can you deploy Docker containers to Heroku, but you can also use this to run a \u201cHeroku-like\u201d environment locally for development.<\/p>\n<p>You\u2019ll notice that there is an environment variable called <code>DATABASE_URL<\/code> in this file. We can modify our <code>database.yml<\/code> file to use this ENV variable to connect to the database.<\/p>\n<pre class=\" brush:php\">default: &amp;default\r\n  adapter: postgresql\r\n  encoding: unicode\r\n  pool: 5\r\n  timeout: 5000\r\n  username: postgres\r\n  host: &lt;%= ENV['DATABASE_URL'] %&gt;<\/pre>\n<p>We\u2019ll be using the <a href=\"http:\/\/puma.io\/\">Puma web server<\/a> for this Rails application, and we need to set up a config file located in <code>config\/puma.rb<\/code>. Please make sure that you have <code>puma<\/code> in your Gemfile as well!<\/p>\n<pre class=\" brush:php\">port ENV['PORT'] || 3000\r\nenvironment ENV['RACK_ENV'] || 'development'<\/pre>\n<h3>Up and running locally<\/h3>\n<p>To run this app locally in the Docker container you can use the following command, which at this point is straight-up Docker and Docker Compose (rather than something specific to Heroku):<\/p>\n<pre class=\" brush:php\">docker-compose up web<\/pre>\n<p>This command will open the app in the browser with the correct IP address:<\/p>\n<pre class=\" brush:php\">open \"http:\/\/$(docker-machine ip default):8080\"<\/pre>\n<p>If all worked well you should be able to see your app running within the Heroku\/Ruby Docker container.<\/p>\n<h3>Deploying to Heroku<\/h3>\n<p>To deploy to Heroku we\u2019ll first need to make sure we have created an app on Heroku. Take note of the name they gave to your app in the output.<\/p>\n<pre class=\" brush:php\">heroku create<\/pre>\n<p>After that we can deploy it using the following command. Keep in mind that you should use your app name on Heroku, not mine:<\/p>\n<pre class=\" brush:php\">heroku docker:release --app warm-fortress-1700<\/pre>\n<p>Once it is done deploying (which will take a few minutes the first time as it uploads the somewhat large image slug to Heroku), you can open it in the browser using the command <code>heroku open<\/code>.<\/p>\n<p>!New Call-to-action<\/p>\n<h2>Building a Minimal Production Image<\/h2>\n<p>When building for a production release, you\u2019ll want to keep your Docker images as lightweight as possible to avoid using up server resources. One of the ways you can do this is by using a trimmed-down Linux distro such as <a href=\"http:\/\/www.alpinelinux.org\/\">Alpine<\/a>. CenturyLink has a <a href=\"https:\/\/hub.docker.com\/r\/centurylink\/alpine-rails\/~\/dockerfile\/\">great Docker image<\/a> available that we can use as our base image.<\/p>\n<p>I have created a <code>Dockerfile.prod<\/code> file as a way to add a couple extra commands that aren\u2019t needed when working in a development environment.<\/p>\n<pre class=\" brush:php\">Dockerfile FROM centurylink\/alpine-rails\r\n\r\n# Configure the main working directory. This is the base\r\n# directory used in any further RUN, COPY, and ENTRYPOINT\r\n# commands.\r\nRUN mkdir -p \/app \r\nWORKDIR \/app\r\n\r\n# Copy the Gemfile as well as the Gemfile.lock and install\r\n# the RubyGems. This is a separate step so the dependencies\r\n# will be cached unless changes to one of those two files\r\n# are made.\r\nCOPY Gemfile Gemfile.lock .\/ \r\nRUN gem install bundler &amp;&amp; bundle install --jobs 20 --retry 5 --without development test\r\n\r\n# Set Rails to run in production\r\nENV RAILS_ENV production \r\nENV RACK_ENV production\r\n\r\n# Copy the main application.\r\nCOPY . .\/\r\n\r\n# Precompile Rails assets\r\nRUN bundle exec rake assets:precompile\r\n\r\n# Start puma\r\nCMD bundle exec puma -C config\/puma.rb<\/pre>\n<p>In this file I\u2019ve run <code>bundle install<\/code> with the <code>--without development test<\/code> flag to avoid Gems we don\u2019t need in our production environment. I\u2019ve set ENV variables called RAILS_ENV and RACK_ENV to production. And lastly I\u2019ve precompiled the assets so that the image will already have all precompiled assets and we won\u2019t need to do that again after deploy. It\u2019s all about making sure our production image is as efficient and small as possible.<\/p>\n<p>Let\u2019s build our production image:<\/p>\n<pre class=\" brush:php\">docker build -t leighhalliday\/rails-alpine -f .\/Dockerfile.prod .<\/pre>\n<p>Notice we\u2019ve included the <code>-f<\/code> directive with a filename to point to our <code>Dockerfile.prod<\/code> file instead of the usual <code>Dockerfile<\/code>.<\/p>\n<h2>Pushing Our Image to Docker Hub<\/h2>\n<p>We\u2019ve built our image locally, but it\u2019s time to push it to Docker Hub. Docker Hub functions very much like GitHub where there are public images and private images. For this demo we\u2019ll be using a public one, but if this is for your company you\u2019d probably want to go with the private version.<\/p>\n<pre class=\" brush:php\">docker push leighhalliday\/rails-alpine<\/pre>\n<p>It is now available at <a href=\"https:\/\/hub.docker.com\/r\/leighhalliday\/rails-alpine\/\">https:\/\/hub.docker.com\/r\/leighhalliday\/rails-alpine\/<\/a>.<\/p>\n<h2>Deploying Our Docker Rails App<\/h2>\n<p>Today we\u2019ll be deploying our app to a pretty typical Linux box (Ubuntu, but it could be anything) which already has Docker and NGINX installed.<\/p>\n<p>We\u2019ll actually have to set up two other images (plus our Rails app, so three in total) on the server for the database. I\u2019m going to be creating one image which is for storing DB data plus another for the DB server itself. Then we\u2019ll run our main Alpine-Rails Docker image and link it to the DB server image. If you\u2019re wondering why I\u2019m doing it this way, Tim Butler has a great article on <a href=\"http:\/\/blog.codeship.com\/docker-basics-linking-and-volumes\/\">Linking and Volumes in Docker<\/a>.<\/p>\n<pre class=\" brush:php\">docker create -v \/var\/lib\/postgresql\/data --name db-data postgres:9.4 \/bin\/true<\/pre>\n<p>And for the DB server itself, which uses the <code>--volumes-from<\/code> directive to point to the <code>db-data<\/code> image from above:<\/p>\n<pre class=\" brush:php\">docker run -d --name db-server --volumes-from db-data postgres:9.4<\/pre>\n<p>Now to run our Rails container:<\/p>\n<pre class=\" brush:php\">docker run -d --name rails-server --link db-server -p 3000:3000 -e SECRET_KEY_BASE=`rake secret` leighhalliday\/rails-alpine<\/pre>\n<p>Here is a breakdown of the directives:<\/p>\n<ul>\n<li><code>-d<\/code>: To run this Docker container in the background<\/li>\n<li><code>--name<\/code>: Giving this container a name<\/li>\n<li><code>--link<\/code>: Linking this container to the <code>db-server<\/code> image<\/li>\n<li><code>-p<\/code>: Exposing port 3000 and linking it to port 3000 on the host system<\/li>\n<li><code>-e<\/code>: Setting an environment variable which Rails will use. You may have to replace <code>rake secret<\/code> with an actual secret because the host server most likely won\u2019t have <code>rake<\/code> installed<\/li>\n<\/ul>\n<p>One important thing to note is that the database.yml file should be set up to point to our linked <code>db-server<\/code> image. To do this we can use the environment variables that the linked image exposes to us. To see a list of them you can run this command:<\/p>\n<pre class=\" brush:php\">docker exec rails-server env<\/pre>\n<p>Two of the ENV variables listed will be something similar to the ones below. We can use these to point to our DB.<\/p>\n<pre class=\" brush:php\">DB_SERVER_PORT_5432_TCP_ADDR=172.17.0.1\r\nDB_SERVER_PORT_5432_TCP_PORT=5432<\/pre>\n<p>Lastly, you\u2019ll probably need to enter the Rails console or to run <code>rake db:create<\/code>. To do so you can use the <code>docker exec<\/code> command on the server. <code>docker exec rails-server bundle exec rake db:create<\/code><\/p>\n<p>To run the Rails console you\u2019ll have to pass the directives <code>-it<\/code>:<\/p>\n<pre class=\" brush:php\">docker exec -it rails-server rails console<\/pre>\n<h3>Configuring NGINX<\/h3>\n<p>If you visit the IP address of the server you won\u2019t get any response yet. This is because our app is listening on port 3000. So instead of adding <code>:3000<\/code> to the IP address, let\u2019s configure NGINX to receive requests on port 80 and forward them to our app on 3000.<\/p>\n<p>We\u2019ll be using the <code>upstream<\/code> directive along with <code>proxy_pass<\/code> to hand the work off to another IP address and port, which happens to be the one for our Rails Docker container. This code would go inside of the <code>http<\/code> block in the NGINX config or in one of the sites-available conf files.<\/p>\n<pre class=\" brush:php\">upstream docker { \r\n  server 127.0.0.1:3000; \r\n}\r\n\r\nserver { \r\n  listen 80; \r\n  location \/ { \r\n    proxy_pass http:\/\/docker; \r\n  } \r\n}<\/pre>\n<h2>Conclusion<\/h2>\n<p>I\u2019ll admit, getting comfortable with Docker can be a pretty steep learning curve. It does have <a href=\"https:\/\/news.ycombinator.com\/item?id=9805528\">some very powerful benefits<\/a> though, not just for development but for deploying and running production code as well.<\/p>\n<p>In this article we looked at doing the simplest deploy possible to Heroku. After that we went along more of a manual path, by hand crafting our own Dockerfile, building the image and deploying it to the Docker hub, and finally running this image on a production server.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"http:\/\/blog.codeship.com\/deploying-docker-rails-app\/\">Deploying Your Docker Rails App<\/a> from our <a href=\"http:\/\/www.webcodegeeks.com\/wcg\/\">WCG partner<\/a> Florian Motlik at the <a href=\"http:\/\/blog.codeship.com\/\">Codeship Blog<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In a previous article by Marko Locher, we learned how to run a Rails development environment in Docker. Marko also wrote about how to test a Rails app with Docker. So assuming we have our dev environment set up, our app is tested (and the tests are passing), we\u2019re ready to think about deploying our &hellip;<\/p>\n","protected":false},"author":113,"featured_media":4127,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[95],"class_list":["post-8215","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ruby","tag-rails"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Deploying Your Docker Rails App - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"In a previous article by Marko Locher, we learned how to run a Rails development environment in Docker. Marko also wrote about how to test a Rails app\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Deploying Your Docker Rails App - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"In a previous article by Marko Locher, we learned how to run a Rails development environment in Docker. Marko also wrote about how to test a Rails app\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-11-09T10:15:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-12-16T08:49:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/rubyonrails-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Leigh Halliday\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@leighchalliday\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Leigh Halliday\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/\"},\"author\":{\"name\":\"Leigh Halliday\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/e496b17f78cdca27723b8e225dc6ab6b\"},\"headline\":\"Deploying Your Docker Rails App\",\"datePublished\":\"2015-11-09T10:15:49+00:00\",\"dateModified\":\"2015-12-16T08:49:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/\"},\"wordCount\":1401,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/rubyonrails-logo.jpg\",\"keywords\":[\"Rails\"],\"articleSection\":[\"Ruby\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/\",\"name\":\"Deploying Your Docker Rails App - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/rubyonrails-logo.jpg\",\"datePublished\":\"2015-11-09T10:15:49+00:00\",\"dateModified\":\"2015-12-16T08:49:42+00:00\",\"description\":\"In a previous article by Marko Locher, we learned how to run a Rails development environment in Docker. Marko also wrote about how to test a Rails app\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/rubyonrails-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/rubyonrails-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ruby\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/ruby\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Deploying Your Docker Rails App\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/e496b17f78cdca27723b8e225dc6ab6b\",\"name\":\"Leigh Halliday\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/bd40251a1acc424c292c35a3485264a801efa20efa7063c3e320a0a354ddafac?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/bd40251a1acc424c292c35a3485264a801efa20efa7063c3e320a0a354ddafac?s=96&d=mm&r=g\",\"caption\":\"Leigh Halliday\"},\"description\":\"Leigh is a developer at theScore. He writes about Ruby, Rails, and software development on his personal site.\",\"sameAs\":[\"http:\/\/www.leighhalliday.com\/\",\"https:\/\/x.com\/leighchalliday\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/leigh-halliday\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Deploying Your Docker Rails App - Web Code Geeks - 2026","description":"In a previous article by Marko Locher, we learned how to run a Rails development environment in Docker. Marko also wrote about how to test a Rails app","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/","og_locale":"en_US","og_type":"article","og_title":"Deploying Your Docker Rails App - Web Code Geeks - 2026","og_description":"In a previous article by Marko Locher, we learned how to run a Rails development environment in Docker. Marko also wrote about how to test a Rails app","og_url":"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2015-11-09T10:15:49+00:00","article_modified_time":"2015-12-16T08:49:42+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/rubyonrails-logo.jpg","type":"image\/jpeg"}],"author":"Leigh Halliday","twitter_card":"summary_large_image","twitter_creator":"@leighchalliday","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Leigh Halliday","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/"},"author":{"name":"Leigh Halliday","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/e496b17f78cdca27723b8e225dc6ab6b"},"headline":"Deploying Your Docker Rails App","datePublished":"2015-11-09T10:15:49+00:00","dateModified":"2015-12-16T08:49:42+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/"},"wordCount":1401,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/rubyonrails-logo.jpg","keywords":["Rails"],"articleSection":["Ruby"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/","url":"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/","name":"Deploying Your Docker Rails App - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/rubyonrails-logo.jpg","datePublished":"2015-11-09T10:15:49+00:00","dateModified":"2015-12-16T08:49:42+00:00","description":"In a previous article by Marko Locher, we learned how to run a Rails development environment in Docker. Marko also wrote about how to test a Rails app","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/rubyonrails-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/rubyonrails-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/ruby\/deploying-docker-rails-app\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Ruby","item":"https:\/\/www.webcodegeeks.com\/category\/ruby\/"},{"@type":"ListItem","position":3,"name":"Deploying Your Docker Rails App"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/e496b17f78cdca27723b8e225dc6ab6b","name":"Leigh Halliday","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/bd40251a1acc424c292c35a3485264a801efa20efa7063c3e320a0a354ddafac?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bd40251a1acc424c292c35a3485264a801efa20efa7063c3e320a0a354ddafac?s=96&d=mm&r=g","caption":"Leigh Halliday"},"description":"Leigh is a developer at theScore. He writes about Ruby, Rails, and software development on his personal site.","sameAs":["http:\/\/www.leighhalliday.com\/","https:\/\/x.com\/leighchalliday"],"url":"https:\/\/www.webcodegeeks.com\/author\/leigh-halliday\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/8215","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/113"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=8215"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/8215\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/4127"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=8215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=8215"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=8215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}