There is surprisingly little information out there on how to deploy
postgres. There is,
on the other hand, quite a bit of information on how to deploy
docker. At the time of writing,
there is nothing on how to do it with
docker-compose specifically. I rarely use
docker apart from
docker-compose, and will go to great lengths to ensure I can dockerize my composition, be it for
etherpad or any other
The following comprises my collection of notes on what it took to build an
docker image and link
it to a
postgres container with
docker-compose. Much of it was inspired (i.e., shamelessly plagiarized) from
the fine work done by tvelocity on GitHub.
The following assumes that the required software (e.g.,
docker-compose, etc.) is installed on an
Ubuntu 16.04 machine. It’s meant to be simple enough that the stated goal can be accomplished by simply
copying and pasting content into the various required files and executing the commands specified.
Create a directory in which to organize your
Using your favourite text editor (mine’s
vim), copy and paste the following into your
node:0.12 image upon which this image is built was chosen purposefully. At the moment,
does not run on
node versions 6.0 and 6.1, which is
what you get if you build off the latest
Also note the
ENTRYPOINT ["/entrypoint.sh"] line. This implies we’ll need this
entrypoint.sh file to
run every time we fire up an image.
Create a file called
entrypoint.sh and paste the following:
This does a whole bunch of stuff. Most importantly, it creates the
settings.json file which
configures the whole
etherpad-lite application. The settings produced above connect the application
postgres database and setup an adminstrative user. There’s a whole bunch of stuff that
can be done to make this more configurable (e.g., setup SSL certs, et al). I’m all ears.
You may have noticed a bunch of environment variables in the previous
Those get set in
docker-compose.yml. Create that file and paste the following:
This sets everything up so that the
Dockerfile gets built and linked to a
postgres container… well, everything except for one bit: it doesn’t create
etherpad_data data-only container.
Create the data-only container from the command line so that your data won’t be erased if your
other containers get smoked by accident or on purpose.
Finally, fire ‘er all up!
If you did everything correctly, your
etherpad-lite application will be accessible on http://localhost:9001.