Install flatnotes Inside Docker Container on Linux

Install flatnotes Inside Docker Container on Linux

The flatnotes is a web application designed for taking notes. It operates without the need for a database, instead storing notes as markdown files within a single directory.

This tutorial explains how to install flatnotes inside a Docker container on Linux. Commands have been tested on Ubuntu.

Prepare environment

Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.

Install flatnotes

  • Host network

Run the following command to create a container for flatnotes that uses host network:

docker run -d --name=flatnotes --restart=always --network=host \
    -v /opt/flatnotes/data:/data \
    -e FLATNOTES_AUTH_TYPE=password \
    -e FLATNOTES_USERNAME=admin \
    -e FLATNOTES_PASSWORD=pwd123 \
    -e FLATNOTES_SECRET_KEY=aLongRandomSeriesOfCharacters \
    dullage/flatnotes
  • User-defined bridge network

User-defined bridge network can be used for listening on different port. By default, flatnotes service is listening on port 8080. It can be changed with -p option.

docker network create app-net
docker run -d --name=flatnotes --restart=always --network=app-net \
    -p 8081:8080 \
    -v /opt/flatnotes/data:/data \
    -e FLATNOTES_AUTH_TYPE=password \
    -e FLATNOTES_USERNAME=admin \
    -e FLATNOTES_PASSWORD=pwd123 \
    -e FLATNOTES_SECRET_KEY=aLongRandomSeriesOfCharacters \
    dullage/flatnotes

Notes:

  • Don't forget to update the password for admin with FLATNOTES_PASSWORD.
  • The secret key is used for generating access tokens. Change it with FLATNOTES_SECRET_KEY.

Testing flatnotes

Open a web browser and go to http://<IP_ADDRESS>:8080, where <IP_ADDRESS> is the IP address of the system. Log in to the UI with the admin username and password.

flatnotes inside Docker container on Linux

Uninstall flatnotes

To completely remove flatnotes, remove its container:

docker rm --force flatnotes

Remove flatnotes image:

docker rmi dullage/flatnotes

You can also remove flatnotes data:

sudo rm -rf /opt/flatnotes

If a user-defined bridge network was created, you can delete it as follows:

docker network rm app-net

Leave a Comment

Cancel reply

Your email address will not be published.