docker搭建在线Markdown服务器

1.安装docker

2.编写docker-compose.yml

version: "3"
services:
  database:
    image: postgres:11.6-alpine
    environment:
      - POSTGRES_USER=codimd
      - POSTGRES_PASSWORD=change_password
      - POSTGRES_DB=codimd
    volumes:
      - "database-data:/var/lib/postgresql/data"
    restart: always
  codimd:
    image: hackmdio/hackmd:2.4.1
    environment:
      - CMD_DB_URL=postgres://codimd:change_password@database/codimd
      - CMD_USECDN=false
    depends_on:
      - database
    ports:
      - "3000:3000"
    volumes:
      - upload-data:/home/hackmd/app/public/uploads
    restart: always
volumes:
  database-data: {}
  upload-data: {}

3.进入docker-compose.yml所在目录,执行命令

docker-compose up -d

4.在云服务器上放行3000端口
5.完成,访问http://server_ip:3000,即可使用,

你可能感兴趣的:(docker,服务器,容器)