Install Etherpad Inside Docker Container in Linux

Install Etherpad Inside Docker Container in Linux

Etherpad is a web-based document editor that allows users to simultaneously edit a text documents. It also provides an integrated chat box for communication.

This tutorial explains how to install Etherpad inside a Docker container in the 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.

You also need to have a running PostgreSQL container. Instructions can be found in the post.

Install Etherpad

Before starting, create etherpad database:

docker exec -it postgresql psql -U postgres -c "CREATE DATABASE etherpad"
  • Host network

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

docker run -d --name=etherpad --restart=always --network=host \
    -e ADMIN_PASSWORD=pwd123 \
    -e DB_TYPE=postgres \
    -e DB_USER=postgres \
    -e DB_PASS=pwd123 \
    -e DB_NAME=etherpad \
    -e DB_HOST=127.0.0.1 \
    etherpad/etherpad

PostgreSQL container should run on host network as well.

  • User-defined bridge network

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

docker network create app-net
docker run -d --name=etherpad --restart=always --network=app-net \
    -p 8080:9001 \
    -e ADMIN_PASSWORD=pwd123 \
    -e DB_TYPE=postgres \
    -e DB_USER=postgres \
    -e DB_PASS=pwd123 \
    -e DB_NAME=etherpad \
    -e DB_HOST=postgresql \
    etherpad/etherpad

PostgreSQL container should run on the same user-defined bridge network as well.

Notes:

  • Don't forget to change admin password for Etherpad using ADMIN_PASSWORD.
  • The DB_USER and DB_PASS can be used to specify PostgreSQL credentials.
  • When user-defined bridge network is used, don't forget to change DB_HOST. It contains PostgreSQL container name.

Testing Etherpad

To access the editor, open a web browser and go to http://<IP_ADDRESS>:9001, where <IP_ADDRESS> is the IP address of the system.

Etherpad Inside Docker Container in Linux

Add /admin in the URL to access admin panel for managing plugins and settings.

Uninstall Etherpad

To completely remove Etherpad, remove its container:

docker rm --force etherpad

Remove Etherpad image:

docker rmi etherpad/etherpad

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

docker network rm app-net

The 5 Comments Found

  1. Avatar
    Steve Reply

    Thank you for this tutorial. One of the very few online that actually works.

    I noticed one issue:

    I am using Etherpad docker with Postgresql docker as described above. Then I have the Etherpad plugin "adminpads3" (same for "adminpads2") enabled. Now as admin I can delete the existing pads. However, when I reboot the entire server, all the deleted pads are showing up again.

    The plugin developer said it is not bug with the plugin. Quote: "After deleting a pad the list updates automatically and total pad number will be reduced by 1."

    He writes: "I'd guess you start docker with the same instance of DB as before deleting pads."

    As this issue will hit every developer who uses this tutorial above, I would like to know a solution for this.

    How can the data stay consistent when rebooting the server?

    • Avatar
      lindevs Reply

      Hi,
      I have the same problem. I am unable to find a way how to persist installed Etherpad plugins when recreating a Docker container. Currently, the plugins are installed as npm packages in the node_modules directory. While there are discussions on the Etherpad GitHub repository about moving of plugins to a dedicated directory, a concrete solution has not yet been implemented.

  2. Avatar
    Steve Reply

    Thank you for your reply. When I reboot the server, all plugins are still there in /admin/pluings. Also the settings.json is the same under admin/settings. So this part is fine. However, the pads that I deleted before (with the help of the plugin) appear again. This is strange. And all other pads until the time of reboot are also there. It seems that all deleted pads are recovered.

  3. Avatar
    Steven Reply

    I have just tested it:

    1. Created a backup of the database (A)
    2. Used the plugin to delete about 30 pads
    3. Created another backup of the database (B)
    4. Result: Backup (A) contains the same pads as backup (B) inside db etherpad.

    But at /admin/pads it shows only the pads that were not deleted.

    Either the Postgresql db dump has an issue, or the deletion does not really delete.

    I could not find the source for socket.emit('delete', padID); to check what is going on with the deletion.

    Important:

    When restarting the Etherpad Docker, the deleted pads do not show up (as expected).

    When restarting the Postgresql Docker, the deleted pads do not show up (as expected).

    However, when rebooting the server, the deleted pads show up again (!)

    Source: https://github.com/harrybleckert/ep_adminpads3/issues/14

    So some "data recovery" seems to happen with the server reboot?!

    • Avatar
      lindevs Reply

      Great work on testing and providing a detailed problem explanation. I hope you will receive a response on GitHub issue.

Leave a Comment

Cancel reply

Your email address will not be published.