No .env file found with Docker compose

Hello,
I’m quite new to docker and server stuffs.
I have my docker-compose.yml like follow,

version: '3'

services:
  webserver:
    build:
      context: ./nginx/
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./nginx/html/:/usr/share/nginx/html/:ro
      - ./nginx/conf/:/etc/nginx/conf.d/:ro
    links:
      - vaultwarden
  vaultwarden:
    image: vaultwarden/server:latest
    ports:
      - 8080:80
      - 3012:3012
    volumes:
      - ./vault/data/:/data/
    env_file:
      - vaultwarden.env

I have vaultwarden.env in the same level as docker-compose.yml. Still when I docker compose up, vualtwarden shows there’s no .env file found. Further I’ve also created just .env file on the same level. Still no updates.

My goal is to use vaultwarden in sub-dir. I need to setup DOMAIN for that as per my understanding from wiki.

Thank you.

Try noting the file location with a qualified relative path:

env_file:
  - ./vaultwarden.env
1 Like

See BlackDex’ explanation: I cannot figure out how to source the .env file - #4 by BlackDex

The .env file mentioned in the logs is unrelated to the environment file used by docker (or systemd). While launching, vaultwarden checks for the existence of such a file in the current working directory of the container and simply informs you if it does not find it.

You could probably bind mount your vaultwarden.env file to /.env instead of specifying it as environment file for docker if you want to get rid of the message.

1 Like