November 17, 20241 yr I'm trying to create a python docker container from a python script of github. It's a script for Immich Webdav Server. I'm able to create the docker image with command "docker build -t app" . When i attempt command "docker run app" i get an error saying values must be set. According to the requirements only the .env file needs it and i still get the same error. I've tried putting the info in the app.py file and still the same error. I'm just a noob trying to build this container, so forgive me if i missed something here. Any help i would really appreciate. Error: root@SERVER:~# cd /mnt/user/appdata/immich-webdav-wrapper root@SERVER:/mnt/user/appdata/immich-webdav-wrapper# docker build -t app . [+] Building 15.4s (10/10) FINISHED docker:default => [internal] load .dockerignore 2.2s => => transferring context: 406B 0.0s => [internal] load build definition from Dockerfile 1.8s => => transferring dockerfile: 486B 0.0s => [internal] load metadata for docker.io/library/python:3.11-slim 0.0s => [1/5] FROM docker.io/library/python:3.11-slim 0.0s => [internal] load build context 1.7s => => transferring context: 295B 0.0s => CACHED [2/5] WORKDIR /app 0.0s => CACHED [3/5] COPY requirements.txt . 0.0s => CACHED [4/5] RUN pip install --no-cache-dir -r requirements.txt 0.0s => [5/5] COPY . . 3.0s => exporting to image 3.4s => => exporting layers 3.1s => => writing image sha256:1c2f53082bbd0a9d035c3e393de229e6cee98fdaf3b00e5740c5b551ce5f5536 0.1s => => naming to docker.io/library/app 0.2s root@SERVER:/mnt/user/appdata/immich-webdav-wrapper# docker run app Traceback (most recent call last): File "/app/app.py", line 246, in <module> run_webdav_server() File "/app/app.py", line 210, in run_webdav_server raise ValueError("IMMICH_URL, IMMICH_API_KEY, and ALBUM_IDS must be set.") ValueError: IMMICH_URL, IMMICH_API_KEY, and ALBUM_IDS must be set. Following this guide/topic @ post 4 on how to build and run container Github script https://github.com/PersistentCloud/immich-webdav-wrapper?tab=readme-ov-file
November 17, 20241 yr you may need ot add data to your .env file in the path. usualy when youy call adocker build to make a image it has a iamge name... is it called app???? ... The error indicates that the required environment variables (IMMICH_URL, IMMICH_API_KEY, and ALBUM_IDS) are not set in the Docker container, and the application (app.py) cannot run without them. Here's how you can address the issue and run the Docker container with the necessary environment variables: 1. Define the Required Environment Variables You need to provide values for the following variables: IMMICH_URL: The URL of your Immich server. IMMICH_API_KEY: The API key for accessing Immich. ALBUM_IDS: One or more album IDs required by the application. If you're not sure what these values should be, consult the documentation or developer of the application for guidance. 2. Run the Docker Container with Environment Variables You can pass the environment variables when running the Docker container. For example: docker run -e IMMICH_URL="http://your-immich-server-url" \ -e IMMICH_API_KEY="your-api-key" \ -e ALBUM_IDS="album1,album2" \ app 3. Use an .env File for Simplicity Create a .env file in the same directory where you built the Docker image, and add the required variables: IMMICH_URL=http://your-immich-server-url IMMICH_API_KEY=your-api-key ALBUM_IDS=album1,album2 docker run --env-file .env app 4. Modify the Dockerfile (Optional) If these environment variables will always have fixed values, you can define them in the Dockerfile itself. Add the following lines to your Dockerfile: Dockerfile add: ENV IMMICH_URL=http://your-immich-server-url ENV IMMICH_API_KEY=your-api-key ENV ALBUM_IDS=album1,album2 rebuild to call it app: docker build -t app . then call docker run app asuming no errors... 5. Verify the Environment Variables in the Container docker run -it app /bin/bash Once inside, inspect the variables: echo $IMMICH_URL echo $IMMICH_API_KEY echo $ALBUM_IDS
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.