Noob question about volumes

I’m trying to build an image containing comfyui based on nvidia base image.
The image is targetted to run mostly on truenas.

repo here

I want to mount a volume to the python environment I create in the dockerfile.

If I define the volume inside the dockerfile, the image doesn’t start in truenas (i suppose this may be a problem of truenas).

But if I try to mount an empty volume to the python env with:

name: comfyui
services:
  comfyui:
    container_name: comfyui-truenas
    deploy:
      resources:
        reservations:
          devices:
            - capabilities:
                - gpu
              count: all
              driver: nvidia
    environment:
      - UID=1000
      - GID=1000
      - PORT=8018
    image: tommasopiantanida/comfyui-truenas:latest
    ports:
      - '8018:8018'
    privileged: True
    volumes:
      - source: mydata
        target: /app/ComfyUI/.venv
        type: volume
        volume:
          nocopy: False

volumes:
  mydata:

The existing python env is not copied to the empty volume… I’m probably doing something wrong… but I don’t know what… any tips ?

It is a bad practice to depend on volume copying the data from the container file system back into the volume before it’s mounted and therefor. It will only work once, when the volume is empty. Furthermore, changes in the image for the target directory will always be eclipsed by the current content of the volume.

Regardless, the way your volume is configured it should already apply “copy data back into the empty volume” . It is the default behavior and requires no extra configuration. You need to configure it if you want to disable the behavior.

Since your compose file looks okay, it could be very well a TrueNAS specific problem.

Thanks! Maybe I found the issue… does ARG Variable survive after the call to the entrypoint.sh ?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.