-
-
Notifications
You must be signed in to change notification settings - Fork 78
Description
Bug Description
The native (e.g. docker compose) behaviour for a .env file in a project is to make its contents available to docker itself, but not expose them automatically to any containers. Variables defined that way can be passed to the containers using the environment attribute - this is useful for using interpolation.
When trying to use this approach, I noticed that all variables defined in the .env file are deployed to all containers in the project, which is unexpected.
Steps To Reproduce
- Create a project with two containers and an
.envfile. Do not use theenv_fileattribute. - Start the project and inspect the environment variables of the two containers. They will incorrectly share the variables defined in
.env.
Expected Behavior
Arcane should not force pass all environment variables to all containers and it should stay close to the native compose way of dealing with environment variables files.
Actual Behavior
Arcane unexpectedly passes all environment variables to all containers
Screenshots
No response
Arcane Version
v1.11.0
Installation Method
Docker Compose (Recommended)
Environment Type
Local Docker (Single instance)
Database Type
SQLite (Default)
Operating System
Linux
Docker Version
29.1.3
Browser & Version
No response
Relevant Logs or Error Messages
### With the project deployed with Arcane:
β dco exec -it nginx_1 sh -c "printenv | grep ARCANE"
ARCANE_dev=true
ARCANE_DOMAIN=arcane.dev
ARCANE_DEV=true
β dco exec -it nginx_2 sh -c "printenv | grep ARCANE"
ARCANE_domain=my_subdomain.arcane.dev
ARCANE_DOMAIN=arcane.dev
ARCANE_DEV=true
### With the project deployed with `docker compose`:
β docker compose up -d
[+] up 2/2
β Container nginx_1 Recreated 0.3s
β Container nginx_2 Recreated 0.3s
β dco exec -it nginx_1 sh -c "printenv | grep ARCANE"
ARCANE_dev=true
β dco exec -it nginx_2 sh -c "printenv | grep ARCANE"
ARCANE_domain=my_subdomain.arcane.dev
β testDocker Compose Configuration
services:
nginx_1:
image: nginx:alpine
container_name: nginx_1
environment:
ARCANE_dev: ${ARCANE_DEV}
nginx_2:
image: nginx:alpine
container_name: nginx_2
environment:
ARCANE_domain: my_subdomain.${DOMAIN}Environment Configuration (.env file)
ARCANE_DOMAIN=arcane.dev
ARCANE_DEV=trueAdditional Context
I currently work around this by using a different name for my .env file and just passing this to arcaneβs container via env_file. This makes the variables available for docker compose without deploying them to the containers themselves. And on my host, to maintain the native behaviour (compose automatically loads any file named .env), I set COMPOSE_ENV_FILES=${project_dir}/.vars.env
Metadata
Metadata
Assignees
Labels
Type
Projects
Status