# Docker Compose

Many users find it useful to run Cup with Docker Compose, as it enables them to have it constantly running in the background and easily control it. Cup's lightweight resource use makes it ideal for this use case.

There have been requests for an official Docker Compose file, but I believe you should customize it to your needs.

Here is an example of what I would use (by [@ioverho](https://github.com/ioverho)):

```yaml
services:
  cup:
    image: ghcr.io/sergi0g/cup:latest
    container_name: cup # Optional
    restart: unless-stopped
    command: -c /config/cup.json serve
    ports:
      - 8000:8000
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./cup.json:/config/cup.json
```

If you don't have a config, you can use this instead:

```yaml
services:
  cup:
    image: ghcr.io/sergi0g/cup:latest
    container_name: cup # Optional
    restart: unless-stopped
    command: serve
    ports:
      - 8000:8000
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
```

Cup can run with a non-root user, but needs to be in a docker group. Assuming user id of 1000 and `docker` group id of 999 you can add this to the `services.cup` key in the docker compose:
```yaml
    user: "1000:999"
```

The compose can be customized further of course, if you choose to use a different port, another config location, or would like to change something else. Have fun!