# Dokku and Docker for Impatient Rubyists

Source: https://rickcarlino.com/2014/dokku-and-docker-for-impatient-rubyists.html
Published: 2014-08-19
Archived: this article may be out of date.

# What is Docker?

It's a way to put your linux applications into their own containers on the same
machine or across a network.
**[It's not the same thing as a VM](http://www.linuxjournal.com/content/containers%E2%80%94not-virtual-machines%E2%80%94are-future-cloud)**.
It's far more efficient and your friends will be envious of your dev ops skills.

# What is Dokku?

[It's a poor man's Heroku written in about 100 lines of
BASH](https://github.com/progrium/dokku). You can run it yourself on a $5
[digital ocean](http://www.digitalocean.com) instance. Unlike Heroku, you have
more control over things. After all, it's your machine. Want to run a background
worker? Need an extra cron job? No problem.

# Key Features

- "Push to deploy" simplicity that automatically detects the kind of app you are
  working on.
- [Supports tons of "buildpacks"](https://buildpacks.io/) or plugins that auto
  configure your app based on the framework you are using. Rails support is
  fantastic.
- It has an awesome ecosystem of 'host it yourself' plugins and modules for
  things like Postgres, MongoDB, Redis, RabbitMQ and all that other stuff the
  cool kids use.

# I'm Sold!

- **Setup a domain.** Make an A record that points to the digital ocean IP.
  `test.rickcarlino.com` points to `162.243.253.93` in my case.
- **Image your Digital Ocean box** to use Dokku. It requires Ubuntu and
  DigitalOcean has a Dokku image you can use by default.
- **Visit the URL of your DigitalOcean machine**. Paste your SSH public key into
  the text box found on the server. **MAC USERS**: Use this to load it in
  clipboard: `pbcopy < ~/.ssh/id_rsa.pub`.
- **Select "Use Virtual Naming for Apps"**. If you are frugal and want to run
  all of your apps off of one box. You will want 1GB of RAM minimum- trust me.
  Name your default app something like 00default to forgo the need to subdomain
  your default app.
- `git remote add dokku dokku@DOMAIN_NAME_HERE:APP_NAME_HERE**` inside your
  app's git repo
- `git push dokku master`

![](/images/2014/dokku_setup.png)

# Noteworthy Plugins:

- [Supervisord plugin](https://github.com/statianzo/dokku-supervisord)
- [PostgreSQL](https://github.com/Kloadut/dokku-pg-plugin)
- [MongoDB Plugin](https://github.com/jeffutter/dokku-mongodb-plugin)

# Cheat Sheet

- `docker ps`: Shows running processes and their status.
- `docker kill <container ID>`: I'll give you three guesses
- `dokku config:set <app> NAME=value` or
  `dokku config:get : Lets you set ENV['SECRETS']` in your app. Useful for open
  source apps that run in the wild.
- `docker logs`: Because sometimes production breaks.
- `dokku help`: A quick overview of all the commands you will ever need (~10).
