Our adventure continues, with Meteor, Node.js, and Docker

Production Meteor and Node, Using Docker, Part II

As a refresher, in Part I we began deploying production Meteor/Node apps in a modern way using Docker. We outlined what made Meteor and Node great for Docker and walked through how to build your first image.

Now, let’s tackle the deployment of a basic setup on the Docker Cloud platform. This will enable you to make practical use of your work from the previous post.

Perhaps what’s both interesting and challenging is, once you learn how Docker and containers work, you realize that was the easy part. Suddenly, you have an image that enables you to run your app. But how and where do you actually use that image? What about load balancing, firewalls, ports, SSL, databases, logging, and … ?

Docker doesn’t inherently make things easier all on its own. It can be quite complex to orchestrate the various running containers. But, services like DCHQ, Containership, Rancher, and Docker’s own cloud service help make it easier to deploy and manage images. This exercise will show you how to implement container solutions you might have thought only the large companies could pull off.

To help you follow this exercise more easily, it’s broken down into several steps. Our first Meteor/node container will be a single instance with no SSL, proxy, or load balancing services.

At Project Ricochet, we routinely keep tabs on new technologies. Where we spot a clear benefit, we’ll implement the technology into our stack. After surveying the landscape for Docker deployment, we’ve become particularly impressed with Docker Cloud. It leverages most of the same interfaces and API’s as Docker, which helps reduce the learning curve. Rather than being another host provider like Heroku (which marks up server costs and abstracts the CPU into virtual units), Docker Cloud allows you to set up clusters on accounts such as Digital Ocean or AWS. You can also use your own server. Docker Cloud’s stackfile format is almost identical to Docker Compose and the networking for linked containers is amazing. The service even enables you to communicate over providers and across redeploys using a secure network to protect internal traffic on

Project Ricochet is a full-service digital agency specializing in Open Source & Docker.

Is there something we can help you or your team out with?


Docker Cloud provides both a web-based GUI and a command-line interface. For this exercise, we’ll refer to the GUI version. It’s how we got started with Docker Cloud, after all.

Deploy a Meteor App

You have a couple choices for Meteor apps:

  1. You can include a Dockerfile in the application code directly. This is suitable for applications that want to control which dependencies get installed more closely.

  2. You can use a Docker image geared towards Meteor deployment. These often have you mount a Docker volume to a particular folder inside the container and then run your app for you. The one I’ve linked here can also be used as a base for your own Dockerfile.

Here’s how Docker Cloud handles this:

Create a Node Cluster

Next step is to create a Node in Docker Cloud. What’s a node cluster? Remember, Docker Cloud works with various third-party providers. That’s where this comes into play. Since you need a machine on which to run your Docker containers, head over to the tab and click .

When you created your account, there was an onboarding step called Link a cloud provider. If you skipped that, do it now. Docker Cloud has various arrangements with hosting companies. You should be able to save a little money if you select a host you haven’t used before. Remember, you can destroy everything later if needed. But using Digital Ocean VM ($5/mo.) for example, would cost something like $0.16 if you ran it for a day.

Alternatively, you can Bring your own node, but we won’t cover that here. Going that route allows you to control your own nodes that are spun up outside of one of the supported cloud providers, perhaps in a cloud not supported in Docker cloud natively, or bare metal servers in your own data center.

The Node Cluster Creation Form

Apply a name to your cluster, select a Provider, and choose an affordable setup. If using Digital Ocean, I would advise 512MB with one node. Then click Launch node cluster.

Create a Service

Easiest way to get started on Docker Cloud is to create a service. This is a run configuration that can be used to provision one or more Docker containers (that is to say, it can scale both up and down). To do this, go to the tab in Docker Cloud and click

Next, choose what you want to deploy. It’s likely you want to deploy an internal app, so click Private repositories and choose the image corresponding to your app. If you need to get your image pushed to Docker Cloud, check out the Repositories tab at the top. When ready, you can click Select ->.

There are three screens on the service creation page featuring many fields you probably don’t need to worry about now. So, simply choose the Docker image, fill out a name, and select the number of instances (go with 1) on the first screen. Also, click to override the port configuration and expose port 80. Docker Cloud will suggest a name (usually including a hash at the end), but you can change this as you like. I’m using meteorapp-dev, for example. Use a name that makes sense for you in this instance.

The next screen lets you configure environment variables. If you’ve deployed Meteor before, you’re probably familiar with these. The ones we definitely need to set are:

  • MONGO_URL: Here, I recommend using a database from a service like Compose.io or MongoLab (or from a server of your own). This is often better for long-running applications like databases. I recommend this here because while learning Docker, the fewer distractions like mongo and passwords, the better. Stay focused my friend — you’ll move faster.

  • ROOT_URL: Use http://<NODE_IP> for now, where <NODE_IP> is the IP of the Node you created.

  • PORT: Use the same port you exposed.

Now, you can save and deploy. The third screen is for configuring volumes, but you don’t need any in this case. In fact, that’s why we like Node for Docker. We’ll typically use other means for data storage — and we can live without the worry of data on a disk. After a short time, your container should show .

Visit the ROOT_URL you specified, and you should see your application running!

This exercise certainly requires that you follow some deliberate steps. But consider where you can go from here! Starting a service was relatively easy, wasn’t it? Think of it — you have your first Meteor/node container up and running!

I can’t wait to share the next installment of this Meteor and Node series with you. Here’s what we’re looking forward to:

  • Continuous Integration

  • Intelligent cross-cloud load balancing (plus Round-robin DNS tricks)

  • SSL

  • MongoDB Replication using volumes

  • Behavioral driven development (BDD)

  • Backups (not boring anymore!)

Click here for the next installment in the series.
Click here for the previous installment in the series.

Curious about how much it might cost to get help from an agency that specializes in Docker?

We're happy to provide a free estimate!