March 23, 2017

Quick Start/Essentials

# let's say your Dokku server is set to run with as its hostname

# create new app called "helloworld" - repeat for each app
dokku apps:create helloworld

# by default (if Dokku is running on virtual host mode) Dokku will setup

# to add an additional domain:
# to the helloworld app, in addition to the
# default domain name (helloworld.example.COM)
dokku domains:add helloworld

# if your app runs on a non-standard port, map it to port 80 (HTTP) and 443 (HTTPS)
# let's say your app runs on port 9999
dokku proxy:ports-add helloworld http:80:9999
dokku proxy:ports-add helloworld https:443:9999

# to remove a port-mapping
dokku proxy:ports-remove httpbin http:8080:8080

# install letsencrypt plugin for dokku
sudo dokku plugin:install

# set letsencrypt email for helloworld app
dokku config:set --no-restart helloworld [email protected]

# request certificate
# for ALL domains associated with the app
# (both and
dokku letsencrypt helloworld

Pushing code to Dokku server

# SETUP: you only need to do this once
# dokku = git remote name - keep it as is
# dokku = username to push code to dokku server - do not modify
# = your dokku server hostname
# helloworld = app name, the one you created in the previous step
git remote add dokku [email protected]:helloworld

# PUSH: run the command every time you need to deploy new code
# dokku: git remote name
# master: git branch you want to push to the server
git push dokku master


# create new app
dokku apps:create <apps-name>

# delete app
dokku apps:destroy <apps-name>

# list all apps
dokku apps:list

Persistent Storage

# create the directory, set permissions
# helloworld: arbitrary name. I recommend setting this to the Dokku app name
mkdir -p /var/lib/dokku/data/storage/helloworld
chown -R dokku:dokku /var/lib/dokku/data/storage/helloworld
chown -R 32767:32767 /var/lib/dokku/data/storage/helloworld

# mount storage folder for app helloworld
# on host: /var/lib/dokku/data/storage/helloworld
# on container: /var/www/html/data
dokku storage:mount helloworld /var/lib/dokku/data/storage/helloworld:/var/www/html/data

# restart app to apply changes
# helloworld: Dokku app name
dokku ps:restart helloworld

# view storage mounts
dokku storage:report

Update: 10/8/2017:


# If dokku acts weird (e.g. after a restart)
# If dokku misroutes requests (e.g. wrong app being served on wrong virtualhost/domain)
dokku ps:restartall

# If you want dokku to rebuild ALL apps
dokku ps:rebuildall

# list proxy port-mapping
dokku proxy:report

# Update (Debian-based installs)
# stop all apps first
dokku --quiet apps:list | xargs -L1 dokku ps:stop
# upgrade
sudo apt-get install -qq -y dokku herokuish sshcommand plugn
# You may need to rebuild apps
dokku ps:rebuildall
Ryan Harijanto

Head of Engineering. Former Sr. Engineer @Netflix , @HotelTonight , @Shutterstock. Previously a Senior Systems Engineer at Netflix, currently technology advisor and board member for emerging companies. Diverse technological knowledge and understanding of various industries.

Leave a Reply

Your email address will not be published. Required fields are marked *