# 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: nabo.codimd.dev/hackmdio/hackmd:2.5.4
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
### Upgrade existing docker compose
1. Bump the image version
2. Run `docker compose pull` to pull the newer images
3. Run `docker compose up -d`
## 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 (Deprecated)
:::info
:bulb: Since version 2.5.1, we no longer ship images for CJK fonts separately. There is only one image now.
:::
## 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 `nabo.codimd.dev/hackmdio/hackmd:2.5.3` 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`