i m trying to setup qbittorrent and tried to use both env_file: & environment: inside compose file.
everything seems to be loaded in container from these env files and the environment section but the “Dir_Conf_n5105” variable is not expanded for some reason. i checked with printenv and config commands both. although it shows the variable under environment section inside container, it doesnt show under volumes/sources section.
i am trying to use one env file defining dir locations and TZ for all the containers i am running. this file is called .env.general. another for puid & guid for some of the containers called .env.id. both of them are in parent directory and qbittorrents own .env inside current directory.
Parent dir
/.env.general
/.env.id
/qbittorrent_nox/.env
/qbittorrent_nox/docker-compose.yml
compose.yml
services:
qbittorrent-nox:
# for debugging
#cap_add:
#- SYS_PTRACE
image: "qbittorrentofficial/qbittorrent-nox:${QBT_VERSION}"
container_name: "qbittorrent-nox"
env_file:
- ../.env.general
- ../.env.id
environment:
#- PAGID=10000 # You can set additional group ID (AGID) of the qbittorrent-nox process by setting the environment variable PAGID. For example: 10000,10001, this will set the process to be in two (secondary) groups 10000 and 10001. By default there is no additional group. Note that you will need to remove --read-only flag (when using Docker) or set read_only: false (when using Docker Compose) as they are incompatible with it.
#- PGID=1000 # You can change the User ID (UID) and Group ID (GID) of the qbittorrent-nox process by setting environment variables PUID and PGID respectively. By default they are both set to 1000. Note that you will need to remove --read-only flag (when using Docker) or set read_only: false (when using Docker Compose) as they are incompatible with it.
#- PUID=1000
- QBT_LEGAL_NOTICE=${QBT_LEGAL_NOTICE}
- QBT_VERSION=${QBT_VERSION}
# - QBT_WEBUI_PORT=${QBT_WEBUI_PORT}
#- TZ=UTC
#- UMASK=022 # It is possible to set the umask of the qbittorrent-nox process by setting the environment variable UMASK. By default it uses the default from Alpine Linux.
# ports:
# # for bittorrent traffic
# - "6881:6881/tcp"
# - "6881:6881/udp"
# # for WebUI
# - "${QBT_WEBUI_PORT}:${QBT_WEBUI_PORT}/tcp"
networks:
- my_network
read_only: false # If you are using the --read-only flag in Docker or read_only: true in Docker Compose, you will need to remove it or set it to false. The read-only setting is incompatible with the way qbittorrent-nox needs to write to its configuration and download directories.
stop_grace_period: 30m
tmpfs:
- /tmp
tty: true
volumes:
- "${Dir_Conf_n5105}/qbittorrent_nox:/config"
- "${QBT_DOWNLOADS_PATH}/torrents:/downloads/torrents"
security_opt:
- no-new-privileges:true
labels:
- "traefik.enable=true"
- "traefik.http.routers.qbittorrent.entrypoints=websecure"
- "traefik.http.routers.qbittorrent.rule=Host(`qbittorrent.home.arpa`)"
- "traefik.http.services.qbittorrent-service.loadbalancer.server.port=${QBT_WEBUI_PORT}"
- "traefik.http.routers.qbittorrent.tls=true"
restart: unless-stopped
# depends_on:
# - traefik
# - nginx-proxy-manager
networks:
my_network:
external: true
name: ${NETWORK_NAME}
.env.general
## General
TZ=Asia/Kolkata
## Directories
Dir_Conf_n5105=/mnt/local/SSD
is there a way to fix this with mentioning Dir_Conf_n5105 in only .env.general and not in .env?