- git
- docker (docker toolbox recommended)
- docker-compose (included in the docker toolbox)
See more here: https://www.docker.com/docker-toolbox
This is a modified version for relative URL.
- Start you docker via
Docker Quickstart Terminal
, you will see a machine IP (remember that). - Run
git clone https://github.com/hackmdio/docker-hackmd.git
. cd docker-hackmd && cd hackmd && docker build -t hackmdio/hackmd:0.4.4-1 . && cd ..
sudo cp nginx.conf.example /etc/nginx/sites-enabled/hackmd && sudo service nginx reload
sudo cp upstart.hackmd.conf /etc/init/hackmd.conf
- Run
docker-compose up
in your docker terminal. - Wait until see th log
HTTP Server listening at port 3000
, it will take few minutes based on your internet. - Press ctrl-C to stop
- Run
sudo service hackmd start
- Open any browser and surf
<machine IP>/hackmd/
Start your docker and enter the terminal, follow below commands:
cd docker-hackmd ## enter the directory
git pull ## pull new commits
docker-compose pull ## pull new containers
docker-compose up ## turn on
Start your docker and enter the terminal, follow below commands:
- run
docker ps
to check all your containers
➜ ~ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2c04d7b1b8d4 dockerhackmd_hackmd "/bin/bash /hackmd/do" 3 days ago Up 17 seconds 0.0.0.0:3000->3000/tcp dockerhackmd_hackmd_1
4949b888c1cb postgres "/docker-entrypoint.s" 3 days ago Up 18 seconds 5432/tcp dockerhackmd_db-postgres_1
- backup postgresql by
docker exec <postgresql_container_id> pg_dump hackmd -U postgres > <postgresql_backup_name>
➜ ~ docker exec 4949b888c1cb pg_dump hackmd -U postgres > postgresql_backup.sql
- copy your backup out of container by
docker cp <container_id>:<backup_path> <host_path>
Similar to backup steps, but last command is
➜ ~ cat postgresql_backup.sql | docker exec -i <container_id> psql -U hackmd
The default setting would use pre-build docker image, follow below steps to customize your HackMD.
- Modify
docker-compose.yml
at line 8image: hackmdio/hackmd:0.4.4
tobuild: hackmd
. - Change the config file in
hackmd/config.json
, example here. - Run
docker-compose build --no-cache
in the docker terminal to build your own image. - Then
docker-compose up
to startup.
Happy HackMD 😄