# Docker Deployment [TOC] ## Using docker-compose to setup CodiMD The easiest way to spin up CodiMD with docker is using docker-compose, see below docker-compose for example config. ```yaml= 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.2 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: {} ``` 1. Copy the config above and save as `docker-compose.yml` 2. Modify your database username and password 3. Run `docker-compose up -d` 4. Visit `http://localhost:3000` in your browser ## Setup proper permission for volume To upload images to local volume, it's important to setup proper permission for volume or the server won't able to write into it. Please allow user named `hackmd` in the docker to access the volume, which user id and group id are `uid=1500, gid=1500`. You can change the volume permission though this command: `chown -R 1500:1500 volume_dir`. ## Pick docker image for CJK fonts From version 2.1.0, we have separate image that includes CJK fonts for PDF exporting. Please change your dockerfile codimd image path to `hackmdio/hackmd:2.2.0-cjk` if you need this. ## Docker image for ARM architecture From version [2.4.2](/@codimd/v2_4_2), we support both amd64 and arm64 architecture by leveraging [Docker multi-arch image](https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/). You can use `hackmdio/hackmd:2.4.2` or `hackmdio/hackmd:2.4.2-cjk` image in x86_64 or arm64 server. Docker will pull the corresponding image with your CPU architechure. ## Migrate from old CodiMD docker-compose (before 1.4.0) 1. Upgrade your image path to `hackmdio/hackmd:1.4.1` 2. If you had mounted a directory volume for image upload, please change the mount path to `/home/hackmd/app/public/uploads` ###### tags: `CodiMD` `Docs`