Skip to content

Dockage Can't See ".env" files #775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
F1zzyD opened this issue Apr 6, 2025 · 1 comment
Open
2 tasks done

Dockage Can't See ".env" files #775

F1zzyD opened this issue Apr 6, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@F1zzyD
Copy link

F1zzyD commented Apr 6, 2025

⚠️ Please verify that this bug has NOT been reported before.

  • I checked and didn't find similar issue

🛡️ Security Policy

Description

It appears that Dockage is not able to see or read .env files correctly. Here's my setup:

dockage compose.yaml

services:
  dockge:
    container_name: dockage
    image: louislam/dockge:1
    restart: unless-stopped
    ports:
      # Host Port : Container Port
      - 5001:5001
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./data:/app/data
        
      # If you want to use private registries, you need to share the auth file with Dockge:
      # - /root/.docker/:/root/.docker

      # Stacks Directory
      # ⚠� READ IT CAREFULLY. If you did it wrong, your data could end up writing into a WRONG PATH.
      # ⚠� 1. FULL path only. No relative path (MUST)
      # ⚠� 2. Left Stacks Path === Right Stacks Path (MUST)
      - ./opt/stacks:/opt/stacks
    environment:
      # Tell Dockge where is your stacks directory
      - DOCKGE_STACKS_DIR=/home/user/services/dockage/opt/stacks

Snippet from a container using an .env

services:
  web:
    container_name: test
    env_file:
      -  /home/user/services/web/.env

Yes, I want my .env file located in a specific directory. I've tried multiple ways of formatting it for Dockage to see, but every time I've gone to do docker compose up the container complains it can't see the file, even though I can open it, read it, and edit it.

👟 Reproduction steps

See above

👀 Expected behavior

It should work lol

😓 Actual Behavior

It don't work lol

Dockge Version

1.5.0

💻 Operating System and Arch

Ubuntu 20.04

🌐 Browser

Firefox

🐋 Docker Version

No response

🟩 NodeJS Version

No response

📝 Relevant log output

env file /home/user/services/web/.env not found: stat /home/user/services/web/.env: no such file or directory
@F1zzyD F1zzyD added the bug Something isn't working label Apr 6, 2025
@Jekotia
Copy link

Jekotia commented Apr 11, 2025

To my understanding, this is a user configuration error. Re-read the comments pertaining to the stacks directory.

You must not use a relative path. You have used a relative path.
Both sides of the volume mount string need to be identical.
The environment variable DOCKGE_STACKS_DIR needs to be the same path defined above.

So, minus the comments, your volumes & environment should look like this:

    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./data:/app/data
      - /home/user/services/dockage/opt/stacks:/home/user/services/dockage/opt/stacks
    environment:
      - DOCKGE_STACKS_DIR=/home/user/services/dockage/opt/stacks

As to why dockge is this particular, my best guess is that it's related to it playing nice with native compose and being able to freely switch between using dockge and the terminal without either spinning up your containers as a new stack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants