Can you set global policy in the Docker compose file during installation?

I am setting up Kopia in server mode using a Docker compose file. Is there a way to set the global policy in the compose file?
For example, is it possible to set the global policy to retain 999 annual snapshots in the compose file in a manner similar to the following?

version: '3.7'
services:
    kopia:
        image: kopia/kopia:latest
        hostname: Hostname
        container_name: Kopia
        restart: unless-stopped
        ports:
            - 51515:51515
        # Setup the server that provides the web gui
        command:
            - server
            - start
            - --disable-csrf-token-checks
            - --insecure
            - --address=0.0.0.0:51515
            - --server-username=USERNAME
            - --server-password=SECRET_PASSWORD
            - --keep-annual=999

The above creates the container but prints the following error to log:

kopia: error: unknown long flag '--keep-annual'

Pleases refer to docs re commands syntax, e.g. in this case:

To set policies you have to run kopia policy set.

So in your example run both commands in your compose.

And in general why to complicate your life by using docker? kopia is single binary without any dependencies.

Thank you for the suggestion. Therefore the relevant section of the compose file should look something like:

command:
            - policy
            - set
            - --keep-annual=999

Is this the correct direction?

Regarding your question as to why I am running Kopia in a container, my host is a Synology NAS machine. The only way I am aware of to run binaries on this operating system is within a container. So far, the container method seems to run Kopia in server mode just fine. Of course I would be delighted to know if there is a simpler approach. Mounting all the virtual paths becomes complicated, especially as I have to create separate Docker containers for each Kopia repository.

First time I hear that only way to run binaries requires containers.

Download binary for your NAS CPU arch and run it directly on the Synology (you will have to SSH to it). It is “normal” Linux at the end with some Syno customisations.

I’m running the binary on multiple Synology NAS (DS216j, DS218 and DS218j) just fine. Make sure to download the right binary for your CPU architecture and drop it into your $PATH. This is completely untested but should work assuming 32-bit ARM CPU:

cd /tmp
wget https://github.com/kopia/kopia/releases/download/v0.18.2/kopia-0.18.2-linux-arm.tar.gz
tar -xf kopia-0.18.2-linux-arm.tar.gz
cp kopia-0.18.2-linux-arm/kopia /usr/local/bin/
chmod a+rx /usr/local/bin/kopia