How to set ADMIN_TOKEN in docker-compose.yml?

I currently have a vaultwarden server that’s running by using docker run per this wiki page: Starting a Container · dani-garcia/vaultwarden Wiki · GitHub and it’s successfully using -e ADMIN_TOKEN=$argon2id$v=19$m=65540,t=3,p=–deleted-- to set my ADMIN_TOKEN.

I am converting it to use a docker-compose.yml file, but when I set ADMIN_TOKEN in the environment: ADMIN_TOKEN: '$argon2id....' area, docker-compose up complains about it.

What am I missing here to get my ADMIN_TOKEN in my docker-compose.yml?

Try putting it in a separate .env file. That’s what I’ve done and it works for me.

1 Like

You are missing this section from the wiki: How to prevent variable interpolation in docker-compose.yml? (i.e. that you have to escape all the dollar signs $ if you configure the ADMIN_TOKEN like that).

1 Like

Thank you. Both of your responses were helpful. I ended up creating an .env file and set VAULTWARDEN_ADMIN_TOKEN='$argon2id$v=19$m=65540,t=3,p=4$MmeK.....' in it and configured my docker-compose.yml with environment: - ADMIN_TOKEN=${VAULTWARDEN_ADMIN_TOKEN} as mentioned in the link provided by @stefan0xC

1 Like

Thank you everyone! using this in conjunction with this detailed Vaultwarden Docker Compose guide, I was able to set everything !!!