Skip to content →

Tag: docker

Let’s Encrypt a Dockerized Rails Application

If you have, or plan to launch, a public facing website that asks users to log in then you need to be using HTTPS. Users expect security, and it’s the least you can provide if you’re asking them for their data. That said, SSL is traditionally a big pain in the ass. It’s not easy to setup and a trusted certificate can cost hundreds of dollars. Luckily all that has changed thanks to Let’s Encrypt and their ACME protocol .  As mentioned on the about page, “Let’s Encrypt is a free, automated, and open certificate authority (CA), run for the public’s benefit.” In other…


Postgres Container Access with a SQL Client

 As you may have read I like to use Postgres’ official image in my multi-container Docker environment. Out of the box it needs little configuration. I typically access it through my Rails app using  rails db or  rails console . The other day, however, I needed to craft some SQL and those tools weren’t cutting it. I wanted to use my SQL client so I could work directly with the schema on something better than the command line. That required some tweaking to my DB container. By default the Postgres image uses Docker’s EXPOSE instruction to open port 5432 for other Docker containers. EXPOSE does not make the port…

Leave a Comment

Continuous Deployment of a Dockerized Rails Application

I believe continuous deployment is a worthy goal for every development team. The practice requires discipline and minimizes the risks associated with releasing large swaths of new code into the wild. I agree with the mantra that deployments shouldn’t be a big deal; that they should be easy to roll back from, and require little ceremony. This tutorial is the last in a series of three that demonstrates how to use Docker in development, continuous integration, and continuous deployment. Follow all three and you’ll have a system where you can push code to master, watch your tests run in CI,  and then have…


Continuous Integration of a Dockerized Rails Application

If you’ve ever worked with continuous integration then you know it’s a valuable tool. Having a CI server run your test suite after each push to a branch is great for discovering integration bugs and for building team confidence. Maintaining a traditional CI server, however, can be a pain. It’s close to, but not quite, a production environment, and it is not a development environment. Instead it’s a nuanced version of both. That difference inevitably leads to someone saying “tests passed on my machine, not sure why they are failing in CI.” If you don’t want to hear those words then I suggest you…

Leave a Comment

Docker Image Reduction Techniques and Tools

Yesterday I spent some time researching how to reduce the size of my Docker image. Weighing in at 841.6 MB while loaded my Rails application image is probably average sized. Docker Hub reports it as 338 MB which is approximately the size of the image after I have docker saved and gzip’d it. That tells me that docker push  and docker pull are transporting much lighter files than I work with on a daily basis. That’s good, but smaller images mean faster deploys, so time researching how to lighten their load seemed worthwhile. Known techniques for reducing Docker image size There are some decent articles that discuss Docker image size in depth…


Docker for an Existing Rails Application

A few weeks ago I decided to take an existing Ruby on Rails application and configure it to work with Docker. I wanted a container-based development environment that fed into a continuous integration to continuous deployment pipeline. The hope is that this style of development would eliminate the differences in environment you typically find between work laptops running OS X and staging, testing, and production servers running Linux. I also wanted to simplify server configuration and maintenance, plus make it super easy for another person to jump on the project. Docker delivers on all these hopes, but with so many different ways to use Docker…