Deploy dockerui to dokku

3 minute read Published:

Table of Contents

One of the problems of dokku is that is a little bit laborious to know which containers or apps are running. Also read the logs of the different apps could take us too much time. One possibility is to install dockerui. This is a popular web interface for the Docker Remote API, that you can use to check which containers are running in your server or see the logs of a container

Build the container (Optional)

First we need to build the container, following the instructions in the

$ git clone
$ cd not-dockers-ui
$ npm install
$ npm install -g grunt-cli

Now we need to configure it to be able to deploy it properly to dokku. Listen in the port 5000 and not expose any port Edit the file dockerui.go so the webserver will listen to the port 5000

var (
	endpoint = flag.String("e", "/var/run/docker.sock", "Dockerd endpoint")
// we change the port that listen the webserver
	addr     = flag.String("p", ":5000", "Address and port to serve dockerui")
	assets   = flag.String("a", ".", "Path to the assets")
	authKey  []byte
	authKeyFile = "authKey.dat"

Then we can build the image

$ grunt release

After that we need to change the Dockerfile and delete the EXPOSE port

FROM scratch

COPY dist /

ENTRYPOINT ["/dockerui"]

Now we build the image

$ docker build -t .
run it to test it
$ docker run -it --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -p 5000:5000 cgonzalezg/dockerui-dokku
Open your browser to http://<dockerd host ip>:5000

and push it to your registry, so then is reachable from your dokku host

docker push

deploy it to Dokku

first create the app

ssh dokku@<your-dokku-host> apps:create dockerui
then add the configurations
ssh dokku@<your-dokku-host> docker-options:add dockerui deploy "-v /var/run/docker.sock:/var/run/docker.sock"
ssh dokku@<your-dokku-host> docker-options:add dockerui deploy "--privileged"
now lets implement the code: create a new folder, init the repo and create a Dockerfile
$ mkdir dockerui && cd dockerui
$ git init
$ git remote add dokku dokku@<your-dokku-host>:dockerui
add this to the Dockerfile
FROM cgonzalezg/dockerui-dokku
ENTRYPOINT ["/dockerui"]
then commit and push
git add -A && git commit -m 'Init commit'
git push dokku master
Now go to http://dockerui.<your-dokku-host> and you should see the dockerui dashboard

For security reason you should not allow dockerui to be public. So it would be a good idea to have some authentication. For that we can use the dokku plugin dokku-http-auth let configured it

# Install the plugin
$ ssh root@<your-dokku-host> dokku plugin:install
# Add the credentials
$ ssh dokku@<your-dokku-host> http-auth:on <user> <password>

And that’s all, now if you go to http://dockerui.<your-dokku-host> it will ask you for credentials

Hope you like the tutorial.

comments powered by Disqus