TrueNAS Scale Native Docker & VM access to host [Guide]

Also, if anyone is interested in increasing the time before reauthentication on the TrueNAS webgui, here’s the command:

sed -i 's/auth.generate_token",\[300/auth.generate_token",\[129600/g'  /usr/share/truenas/webui/*.js

Change, 129600 to how long you want in seconds.

1 Like

Hi @Scepterus, really great guide! I was able to follow all of it so far, making it to Stage 5. I am new to both truenas and docker, so I was very happy to have both of them up and running by the end of that. I, however, did ignore some errors and skip some steps to get to that point, which I hope you can help me resolve in this post.

There are 2 and it seems like they are both networking-related.

I realized in Stage 4 that I wasn’t able to connect to docker in that curl command. I also wasn’t able to ping to google.com with ping -c 3 google.com but could ping to Google primary DNS 8.8.8.8, suggesting to me something went wrong with resolving hostnames. I undid Stage 2 by enabling DHCP again and was able to download and get docker, docker compose and portainer running.

I want to go back to this step and do it properly. Was it expected that I lost internet access? Perhaps this has something to do with also not deleting the br interface?

What should I do exactly to delete the br interface? Is this something I need to go back to Wendell’s guide to find out?

Great guide once again and Happy New Year!

Hey @bingsoo thanks, I 'm glad to hear it helped you with your journey.

As for your questions, I’ll have to know a few details first. Which version of TrueNAS are you using? Did you follow Wendell’s Guide first?
If all that was broken was the DNS, it seems you did not configure a DNS address when you disabled the DHCP and set the IP manually. I guess that’s on me for not thinking about it and adding that to the guide.

You can try doing it again, but making sure you have DNS configured.
That is assuming you came here after Wendell’s guide and have his bridge setup.

Hi @Scepterus, I am running TrueNAS-SCALE-22.12.0, which I understand is bluefin. I was able to follow your updated guide without first following Wendell’s or your pre-bluefin one.

It’s true that I haven’t configured a DNS address. I have no idea what DNS address is or how to configure it. Is this only relevant if I followed Wendell’s guide? I haven’t. What should my next steps be?

OK, so there’s your problem. DNS or Domain Name Resolver is responsible for resolving the domain name aka google.com and giving you the IP of it.

You should have it setup for TrueNAS anyway through the general settings, that way TrueNAS will be able to have access to the internet.

However, if you did not have a bridge before, my guide still has DHCP enabled on the physical address. It only instructs to disables the DHCP on the virtual bridge that enables VM access if you have Virtual Machines that need access to the host.

I see. Three quick clarification questions before I do further reading/research.

  1. My TrueNAS has access to the internet with DHCP enabled. I was, for example, able to perform curl -fsSL https://download.docker.com/linux/debian/gpg with no problems. Do I still need to set-up DNS?

  2. I apologize in advance if I’m being dense, but here I understood the guide as asking for DHCP to be disabled on the physical interface.

  1. Regarding the bridge, can you verify that this is the section of Wendell’s guide I have to follow? TrueNAS Scale: Ultimate Home Setup incl. Tailscale > Not to worry, we’ll fix it.. This, I understand, I will do after I disable DHCP on the virtual bridge.
  1. It’s always best to have a DNS configured on your NAS just in case something happens to the DHCP DNS.
  2. Yes, it does seem to contradict both itself and my earlier statements. But the reason I set up a manual IP there is to ensure your NAS is accessible through only one IP and that will not change, I should clarify that in the guide.
  3. You don’t have to follow Wendell’s guide at all, I went through the steps to setup my version of the bridge here.
  1. Okay, great tip!
  2. Okay, the latest version of your guide clarified it for me.

I thought I had to do something here (that needed referring to Wendell’s guide) but I didn’t have to because I didn’t execute Wendell’s guide.

I think I’m good to proceed to Stage 6 once I set up my DNS then. Thanks!

1 Like

No problem, and thank you for helping me refine the guide.

1 Like

Currently looking into building a TrueNAS scale machine and studying different aspect of it, love your guide!

1 Like

Thank you for the kind words.

@Scepterus, you might want to update this link to point to the Debian installation instructions instead.

I tried this initially and it didn’t work (something about not being able to find the bullseye release).

Your more detailed instructions got me through, and by comparing the detailed commands, I realized why it didn’t work in the first place.

Just did, thanks.

1 Like

I am about to shut down my TrueNAS system for the first time ever to modify some hardware. This would also be my first time rebooting ANY TrueNAS system.

A bit nervous because I remember people talking about stuff not surviving reboots on TrueNAS all the time. I don’t exactly remember what sort of data (app data or storage), setting (e.g. environmental variables), or applications went missing and why, and the conditions for their disappearance, so I can’t elaborate. However, I also later found out that TrueNAS Scale is an appliance and should not be used like an OS (e.g. apt was disabled for a reason). Regardless, I’m still glad that I followed this guide and ran Docker natively. I would love for all of my set-ups to be replicable, so doing things on Debian instead of the TrueNAS GUI is better in my opinion (of course provided it doesn’t break anything else).

Nevertheless, I should ask for some advice; and given that I started my TrueNAS journey here, I thought I’d ask in this thread. Do I need to worry at all? What should I look out for before and after I shut down? Should I rerun some commands after a reboot? Shoot me any advice that is peculiar to this set-up or just plain TrueNAS, as I also know close to nothing about the behavior of the latter!

Thanks!

That is a load of rubbish, that’s what they want you to think, so they don’t have to support people breaking TrueNAS and reporting bugs. As long as you know what you are doing, go ahead.

Do you mean CLI? because I might not fully understand what Debian has to do with what happens on TrueNAS.

No, if you follow this guide, everything will survive a restart for sure. As for your dockers, I can’t promise anything if you did not configure them to stop only when stopped or did not use volumes on your storage.

If you followed the guide, you’ll see there’s a script that runs post-init, that runs all the commands needed after a reboot.

My advice? Don’t be so afraid, if something breaks it’s a great opportunity to learn something new while figuring out how and why it broke. Dive in, and you’ll enjoy the journey, stay afraid, and you won’t even get started.

1 Like

Yes, you’re right – I was trying to make a GUI vs CLI comparison first and foremost, but then also a OS comparison (Debian being more common than TrueNAS). Isn’t TrueNAS running on Debian Linux?

Do you mind clarifying what this is about?

Can you also clarify what you mean here? I followed felixthecat’s guide to create all my Datasets on TrueNAS Scale (via the GUI); and I pointed volumes in my docker compose files to sub-directories of these Datasets. Is that okay?

Oh right, I did do that.

I get that. I love to learn, for sure; but I did also embark on this TrueNAS journey because I do actually need a NAS to store important files. Everything else – self-hosting Nextcloud, Jellyfin, etc – are nice-to-haves and secondary. I couldn’t care less if those or the OS broke, but I do actually want to preserve my data. If breaking the OS means losing my data, I also want to try to avoid that; unless I already know what to do to retrieve my data quickly in that situation, which I don’t – so that’s why I need to be careful right now as I gain more knowledge. For example, can I link a new install of TrueNAS Scale to existing files on a hard disk that used to live on a Dataset? Can I just pop my hard disks into a Windows system to retrieve my files?

I’m not averse to learning by breaking things; but definitely prefer to learn from other people’s experiences of breaking things, if that’s an option (and in the process save time and effort :slight_smile:).

One additional question: How do you keep the post-init and docker compose files (did I miss anything else?) version-controlled (and therefore backed up) and easily “redeployed” in a different system? Everything seems scattered and Portainer is a GUI, which I am beginning to think is a bad idea (just for me). I do want to do this before I perform the system reboot.

I appreciate your reading and responding to my long messages, @Scepterus!

TrueNAS Scale is, TrueNAS Core runs on FreeBSD.

When you configure a docker you can specify the restart conditions, there are 3 options: always, unless-stopped and never. (could be more just of the top of my head.) so I usually use unless stopped, that way even if I restart the host, the dockers come back up as soon as the service is available to load them.

That’s fine, if you do not point them there they’ll stay inside the docker and will be lost if the container is removed.

It does not, you can always import the pool on a fresh install of TrueNAS or any other ZFS capable OS.

not unless you didn’t use ZFS. But look to the previous answer.

? You can just put them in one of your data set and have snapshots enabled on that, or you can also back those up on your PC. I don’t see a reason to do that, I can always just grab them again from my post.

Portainer is really nice for managing dockers, but as mentioned, it is optional.

Sure thing, if I can help, why not?

1 Like

Just updated to 22.12.1 so far here are the steps I needed to get up and running:
Re-Enable apt chmod +x /bin/apt*
touch /etc/docker.env
apt update and upgrade
and docker returned to normal.
I will update the init script to check if that file exists.

UPDATE:
updated the first post. The init script now checks if apt is executable, and if not makes it so, and also checks if docker.env exists and created it if not.

1 Like

So I signed up here to post a question regarding a write permissions issue between docker containers hosted on a remote Debian VM accessing my TrueNAS SMB share for persistent data storage. I found this guide when searching and this line has me thinking that my problems stem from this:

Do you know if this applies to any situation where docker containers are attempting to use remote SMB storage?

Thankfully, it appears that I have found an alternative way to implement what I want!. Thanks for the guide!

Hello and welcome to the forum!
To answer your question, yes, docker does not like SMB and SMB locks files and does not let them go (dumbed and watered down explanation I also got)
I am glad my guide helped you.

1 Like