Dokku is an extensible, open source Platform as a Service that runs on a single server of your choice. If you ever used Heroku, then think of it as your hosted version of Heroku. You can have docker based Platform as a Service running on a single server. In this guide, we will cover the installation of Dokku PaaS on Ubuntu Linux System.

Setup Requirements

  • Installed and updated Ubuntu system
  • Docker Engine
  • At least 1GB of system memory
  • Server with FQDN set – Can be on DNS or /etc/hosts

We will install Dokku using the both methods to install Dokku on Ubuntu Linux server. I recommend installing Dokku from the apt repository so that you can have a view of what’s happening.

1) Update system & set hostname

Set system hostname using the hostnamectl command:

sudo hostamectl set-hostname dokku.computingforgeeks.com

Ensure your system is updated and upgraded:

sudo apt update && sudo apt upgrade -y
[ -f /var/run/reboot-required ] && sudo reboot -f

2) Install Docker Engine

You can install either stable release of Docker or edge release, both are supported by Dokku.

wget -nv -O - https://get.docker.com/ | sudo bash -

Add your user account to docker group:

sudo usermod -aG docker $USER
newgrp docker

This is unattended installation, wait for it to complete then confirm docker engine version installed:

$ docker --version
Docker version 27.0.3, build 7d4bcd8

3) Add Dokku APT repository

Import Dokku APT GPG key:

wget -qO- https://packagecloud.io/dokku/dokku/gpgkey | sudo tee /etc/apt/trusted.gpg.d/dokku.asc

Add repository to the system.

  • Ubuntu 24.04
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ jammy main" | sudo tee /etc/apt/sources.list.d/dokku.list
  • Ubuntu 22.04
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ jammy main" | sudo tee /etc/apt/sources.list.d/dokku.list
  • Ubuntu 20.04
echo "deb https://packagecloud.io/dokku/dokku/ubuntu/ focal main" | sudo tee /etc/apt/sources.list.d/dokku.list

4) Install Dokku on Ubuntu

Once docker has been installed, you can proceed to install Dokku on your Ubuntu LTS system. This is done by updating system packages and installing dokku package:

sudo apt update && sudo apt install dokku -y

If you want unattended installation run:

echo "dokku dokku/vhost_enable boolean true" | sudo debconf-set-selections
sudo apt update && sudo apt install dokku -y

Dependencies installed through apt include:

  • herokuish
  • sshcommand
  • plugn

When asked whether to enable nginx vhosts plugin, answer yes

install dokku ubuntu 01

Confirm or change your server hostname / IP address

install dokku ubuntu 02

You can go with default for initial user.

install dokku ubuntu 04

Installation of dokku will also configure nginx for you and create a systemd service unit for managing the service.

$ systemctl status nginx
 nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: enabled)
     Active: active (running) since Sun 2024-07-14 18:08:56 UTC; 4min 13s ago
       Docs: man:nginx(8)
   Main PID: 60346 (nginx)
      Tasks: 3 (limit: 9489)
     Memory: 2.5M (peak: 2.7M)
        CPU: 14ms
     CGroup: /system.slice/nginx.service
             ├─60346 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
             ├─60347 "nginx: worker process"
             └─60348 "nginx: worker process"

Jul 14 18:08:56 noble systemd[1]: Starting nginx.service - A high performance web server and a reverse proxy server...
Jul 14 18:08:56 noble systemd[1]: Started nginx.service - A high performance web server and a reverse proxy server.

Install dokku dependencies:

sudo dokku plugin:install-dependencies --core

A user and group named dokku is also added to the system, its home directory is /home/dokku. This user account is used when deploying applications to Dokku.

$ id dokku
uid=1001(dokku) gid=1002(dokku) groups=1002(dokku),4(adm),998(docker)

Dokku version can be checked using:

$ dokku version
dokku version 0.34.7

5) Using Dokku on Ubuntu

See the user management and domains documentation for more information.

Deploy your first application

With everything setup, you should be able to deploy to the Dokku installation.

Installing Dokku Plugins

Dokku provides a handful of Plugins to manage other functionalities. All are available on Dokku has official plugins. Installation of these plugins is done on the Dokku host as a root user or using a user account with sudo privileges.

See examples below:

Install PostgreSQL  datastore service:

sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git

Install MariaDB datastore plugin:

sudo dokku plugin:install https://github.com/dokku/dokku-mariadb.git mariadb

Deploying Apps to Dokku

Now that you have a working Dokku installation on your Ubuntu system, you can begin deployment of applications. You can read a comprehensive guide on deploying apps to Dokku.

Conclusion

Dokku is a free and open-source Docker-based PaaS that allows you to basically do the same things as Heroku on your own infrastructure (on-premises or cloud). It is easy to setup and use. If you have any challenges with the installation and configuration, let me know through the comment section.

LEAVE A REPLY

Please enter your comment!
Please enter your name here