#Environment Variables Creating Duplicate Folders (Docker)

1 messages · Page 1 of 1 (latest)

twilit lynx
#

I'm testing a new installation using docker/docker compose and a .env file on Ubuntu 24.04. Docker is working fine for my other 10+ containers.

I've configured my .env to change the locations of UPLOAD_LOCATION, THUMB_LOCATION, ENCODED_VIDEO_LOCATION, PROFILE_LOCATION, BACKUP_LOCATION & DB_DATA_LOCATION.

All paths are either locally mounted drives (ZFS) or a mounted network share (SMB) that is mounted via fstab and accessible. /data/docker is local, /data/media is mounted SMB.

As soon as I start the container, the files and folders are created both in the locations specified (thumb, profile, etc.) AND they are created in the location specified for UPLOAD_LOCATION. However, Immich seems to be using the folders in the correct locations.

I can delete everything, including the containers/images and start again, but the same thing happens.

I have also tried specifying the volume paths directly into the .yml file instead of using the variables, with the same results.

.env = https://pastebin.com/RiwzwNig
docker-compose.yml = https://pastebin.com/3JS1JE6A

Not sure what I'm missing. Thanks

sacred geyserBOT
#

:wave: Hey @twilit lynx,

Thanks for reaching out to us. Please carefully read this message and follow the recommended actions. This will help us be more effective in our support effort and leave more time for building Immich immich.

References

#

Checklist

I have...

  1. :blue_square: verified I'm on the latest release(note that mobile app releases may take some time).
  2. :blue_square: read applicable release notes.
  3. :blue_square: reviewed the FAQs for known issues.
  4. :blue_square: reviewed Github for known issues.
  5. :blue_square: tried accessing Immich via local ip (without a custom reverse proxy).
  6. :blue_square: uploaded the relevant information (see below).
  7. :blue_square: tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable

(an item can be marked as "complete" by reacting with the appropriate number)

Information

In order to be able to effectively help you, we need you to provide clear information to show what the problem is. The exact details needed vary per case, but here is a list of things to consider:

  • Your docker-compose.yml and .env files.
  • Logs from all the containers and their status (see above).
  • All the troubleshooting steps you've tried so far.
  • Any recent changes you've made to Immich or your system.
  • Details about your system (both software/OS and hardware).
  • Details about your storage (filesystems, type of disks, output of commands like fdisk -l and df -h).
  • The version of the Immich server, mobile app, and other relevant pieces.
  • Any other information that you think might be relevant.

Please paste files and logs with proper code formatting, and especially avoid blurry screenshots.
Without the right information we can't work out what the problem is. Help us help you ;)

If this ticket can be closed you can use the /close command, and re-open it later if needed.

open anchor
#

Are you sure they're not just mounted, what happens if you compose down?

twilit lynx
#

As in do the folders go away? No, when I shut down the container with compose down, it shuts down as expected and the folders remain

#

This is a screenshot of the location specified in UPLOAD_LOCATION:

#

This is a screenshot of the directory specified in THUMB_LOCATION, etc.:

open anchor
#

Curious curious... I wonder if it has something to do with the top folder being on SMB

#

You could try mounting only the two subfolders, library and upload? 🙂

#

So change

      - /data/media/testphotos:/usr/src/app/upload
      - /data/docker/docker_volumes/immich/thumbs:/usr/src/app/upload/thumbs
      - /data/docker/docker_volumes/immich/encoded-video:/usr/src/app/upload/encoded-video
      - /data/docker/docker_volumes/immich/profile:/usr/src/app/upload/profile
      - /data/docker/docker_volumes/immich/backups:/usr/src/app/upload/backups
      - /etc/localtime:/etc/localtime:ro

To

      - /data/media/testphotos/upload:/usr/src/app/upload/upload
      - /data/media/testphotos/library:/usr/src/app/upload/library
      - /data/docker/docker_volumes/immich/thumbs:/usr/src/app/upload/thumbs
      - /data/docker/docker_volumes/immich/encoded-video:/usr/src/app/upload/encoded-video
      - /data/docker/docker_volumes/immich/profile:/usr/src/app/upload/profile
      - /data/docker/docker_volumes/immich/backups:/usr/src/app/upload/backups
      - /etc/localtime:/etc/localtime:ro
twilit lynx
#

Ok, I'll give that a shot. Thanks

#

I think that may have done it.

#

But unveils another issue that I'm guessing can't be done

#

I wanted to have each user's uploads be under their own folder. For example, John currently has folders of pictures under his folder and Jane has folders of pictures under her folder. I wanted John's Immich uploads to be a subfolder under his folder, alongside his existing folders/pictures, and the same for Jane.

I thought this was possible with storage templates, but it looks like that path begins at the upload folder, correct?

wheat rock
#

Yeah, assets are always stored per user

twilit lynx
#

So if I make a storage template and then storage label for John called "Johns Pictures", it would actually put his uploads under the /testphotos/upload directory and create a new folder called Johns Pictures

twilit lynx
#

I found a way to make it work by making a new volume path that redirects the storage label folder to the desired folder inside John's personal folder

#

Thanks for your help!

open anchor
#

The storage templated uploads will be in /usr/src/app/upload/library/user-string

vast bison
#

Few things here. 1) docker making empty subfolders for mount points is totally normal, and not something to worry about. That’s how docker handles nested mounts
2) splitting library and upload like that is really not a good idea because now files have to be fully re written to disk for the storage template

#

It would be better to go back to how you had it. The empty folders aren’t hurting anyone

wheat rock
#

I had no idea it did that lol

twilit lynx
# vast bison Few things here. 1) docker making empty subfolders for mount points is totally n...

Thanks. What do you mean by they have to be fully re written? Do you mean when a photo is uploaded, it first writes to an area of the disk, then written a second time when it renames due to the storage template?

The empty folders are messy and causes confusion/complication, which drastically impacts WAF. We have a NAS with mapped drives (her P: Drive), so she accesses the NAS directly to view/access her photos that are not from her phone. For example, lightroom dumps all of her photos into her "Janes Pictures" folder mapped as P:. Photoshop uses the same file structure. So I need Immich to put her phone pictures into a folder beneath "Janes Pictures" and called something like "Phone Pictures". That way she can go to the parent folder "Janes Pictures" and have access to all of her pictures in one location.

#

I put a volume in the docker-compose.yml like this:
"/data/media/testphotos/Janes Pictures/Phone Backup:/usr/src/app/upload/library/jane"

And I gave her a storage label called "jane"

vast bison
#

Yes. Separate mount points will require a full disk level rewrite when files are moved from upload to library

twilit lynx
#

Ok. I was curious as to what the difference was between the two directories. So initial upload goes to Upload and is then moved to Library?

vast bison
#

Yes, if storage template is enabled

twilit lynx
#

Ahh. So if they are the same, then it just renames them rather than re-writes

vast bison
#

Its not a huge deal but good to know

twilit lynx
#

Maybe I could put my Upload directory on an internal ssd drive then and it would immediately move them to my NAS in the Library directory

vast bison
#

If youre doing split mounts, theres no good reason to use a HDD for upload/