Docker compose - specify dockerfile external location

Operating system: TrueNas ElectricEel-24.10.2.4

Docker environment: DockGe | App Version: 1.5.0 | Version: 1.2.14

Trying to install: Caddy
For the sake of formating, I have a google doc created that I’ve been using to document my steps, here it is: Caddy - Google Docs

Any help is appreciate it, sorry if it’s a stupid question.

Setup:

  • I have a dataset dedicated to all the -arr apps, and will be adding a folder for caddy in there instead of creating a new dataset

  • I have very limited experience with docker, I set up qbittorrent and jfa-go, that’s pretty much it, sorry if the post is a dumb question, I tried looking through forums and documentation and couldn’t find an answer.

Prep:

  • Will be using DockGe

  • Using this video https://www.youtube.com/watch?v=ZOtUco5EwoI&t

  • Using DNS challenge

  • From my understanding I’ll have to have a specific file system

  • From what I understand all files need to be created before the compose is ran in DockGe

  • In the compose 2 volumes should be added, 1 for the config, 1 for the data

  • Need to manually mount the Caddyfile and Index.html

  • I will be using cloudflare for DNS

Steps:

  1. I have created the file system

  2. Created Zone-Zone-Read and Zone-DNS-Edit Cloudflare token

  3. Edited .env file accordingly

  4. Added the following 2 folders, and mounted them as volumes in the compose yaml

- /mnt/NAS 16TB 2 Vdevs Mirrored /arr-apps/Caddy/Config:/config

- /mnt/NAS 16TB 2 Vdevs Mirrored /arr-apps/Caddy/Data:/data

  1. Leaving the following 2 lines as is now, hoping that it’ll be able to find the caddyfile and index.html on it’s own in the folder, if not then I’ll try to specify the path as I did with the data and config folders
    • ./Caddyfile:/etc/caddy/Caddyfile

- ./index.html:/usr/share/caddy/index.html

  1. Edited caddyfile to reflect my dns

  2. Probably missing something

  3. From what I understand I don’t portainerportainerneed CSR and ACME certificates saved in my truenas certificates tab when using reverse proxy with caddy, as it pulls it automatically from CF.

  4. Going to try spinning it up

  5. I assume that pasting the compose yaml will auto build it, and add the caddy network on it’s own since both the build and network commands are in there

  6. Pasting the compose and hoping for the best

[+] Building 0.2s (1/1) FINISHED docker:default => [caddy internal] load build definition from Dockerfile 0.1s => => transferring dockerfile: 2B 0.0sfailed to solve: failed to read dockerfile: open Dockerfile: no such file or directory

  1. Looks like I’ll have to specify the file dir for dockerfile like I did for the config & data folders

  2. Based on a stack overflow post, I should just use:

context: . dockerfile: <Below_Directory>/Dockerfile

  1. Adding that

Compose can now delegate builds to bake for better performance. To do so, set COMPOSE_BAKE=true.[+] Building 0.0s (0/0) docker:defaultresolve : lstat /mnt/NAS 16TB 2 Vdevs Mirrored : no such file or directory

  1. No such file or dir

  2. Stuck

  3. Tried changing the path syntax to ./mnt/NAS 16TB 2 Vdevs Mirrored /arr-apps/Caddy/Dockerfile.txt

  4. No luck, tried changing it again many times, same issue

  5. Not sure how to specify the dockerfile path in dockge

Trying to install it through a different compose file, will see if that works

I doubt you will get any usefull response to your post in this forum

First of all, TrueNAS Scale does not use vanilla docker, it uses the docker.io packages from debian’s distro repository, which are not supported by this forum. You can check it yourself with journalctl -x -u docker | grep "Support:"

Furthermore, TrueNAS Scale uses a modified and very opinionated way to store the docker engines configuration. From what I know, only containers deployed from the TrueScale App UI survive a reboot of the NAS. This behavior is special to TrueNAS Scale.

Your chances to get a good response are magnitutudes higher in the TrueNAS forum, then here where people use vanila docker, and don’t know anything about the specialities of running docker on TrueNAS Scale.

1 Like

Sounds good, thanks for the reply!

I need to correct myself. Apparently my understanding was wrong about containers deployed outside the TrueNAS Scale App UI: they do survive a reboot of the NAS. They are just not listed in the Apps list.

What I wrote must be from back then when TrueNAS used k3s, instead of docker, to run containers.

Thx for letting me know, will keep it in mind.

Haven’t had the chance to dive back into it, but I don’t work on Thursday so I’ll keep trying then, I think the only issue I have is using the “volumes:” command and how to mount truenas volumes through docker properly, once I figure it out, I think it’ll be easy from there.