Skip to content

dify-plugin-daemon container crashes on startup due to missing .env file #592

@weichun-wang

Description

@weichun-wang

Self Checks

To make sure we get to you in time, please check the following :)

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • "Please do not modify this template :) and fill in all the required fields."

Versions

  1. dify-plugin-daemon main-local
  2. dify-api main

Describe the bug
When starting Dify locally using docker compose up -d, the plugin_daemon container fails to start with an error indicating it cannot find the .env file.

The error message shows:

goroutine 1 [running]:
github.com/langgenius/dify-plugin-daemon/pkg/utils/log.Panic(...)
 /app/pkg/utils/log/log.go:70
main.main()
 /app/cmd/server/main.go:19 +0x3e5
2026/01/29 02:11:45 ERROR failed to load .env file error="open .env: no such file or directory"
panic: failed to load .env file

To Reproduce
Steps to reproduce the behavior:
1. Clone Dify repository and navigate to the docker deployment directory
2. Run docker compose up -d
3. Check the logs for the plugin_daemon container using docker logs dify-plugin_daemon-1
4. See the error about missing .env file

Expected behavior
We have already set the environment variables in docker-compose.yml (screenshot below). The container should contain a .env template file with placeholders, and the container should automatically read environment variables during startup. Alternatively, the container should be able to start without requiring a physical .env file in its working directory.

Screenshots

Image

Additional context
Issue Analysis:
The dify-plugin-daemon application requires a .env file at startup, but the official Docker image doesn't include it. While the source repository contains a .env.example template file, it's not copied into the Docker image during the build process.

Root Cause:
The Go application (line 19 in main.go) calls godotenv.Load() which expects a .env file in the working directory. However, the Dockerfile doesn't copy .env.example or create a .env file, causing the container to fail on startup.

Evidence:
1. Source repository has .env.example but not .env
2. Docker image inspection shows neither file exists in /app/
3. Error trace points to main.go:19 where godotenv.Load() is called

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions