QNAP TS-877 Truenas Journal

instead of jailmaker, people suggested to setup docker this other way
https://www.reddit.com/r/truenas/comments/18wllxd/opinions_on_using_docker_compose_in_truenas_scale/

i rather get jailmaker to work but i’m at a loss here x-x;

all i need right now is able to use the docker commands, at that point i know what to do for deploying docker containers. But when i checked from shell, it said not found. so what now :smiling_face_with_tear:

:thinking:

jlmkr list
NAME   RUNNING STARTUP GPU_INTEL GPU_NVIDIA OS     VERSION ADDRESSES    
docker True    False   True      False      debian 12      192.168.0.20…
root@xxxxxxxxxxxxx[~]# jlmkr log docker
Apr 23 xxxxxxxxxxxxx systemd[1]: Starting jlmkr-docker.service - My nspawn jail docker [created with jailmaker]...
Apr 23 xxxxxxxxxxxxx .ExecStartPre[xxxxxxxxxxxxx]: PRE_START_HOOK
Apr 23 xxxxxxxxxxxxx systemd[1]: Started jlmkr-docker.service - My nspawn jail docker [created with jailmaker].
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: systemd 252.22-1~deb12u1 running in system mode (+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT -GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 >
Apr 23 xxxxxxxxxxxxxsystemd-nspawn[xxxxxxxxxxxxx]: Detected virtualization systemd-nspawn.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: Detected architecture x86-64.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: Detected first boot.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: 
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: Welcome to Debian GNU/Linux 12 (bookworm)!
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx: 
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: Initializing machine ID from container UUID.
Apr 23 xxxxxxxxxxxxxsystemd-nspawn[xxxxxxxxxxxxx]: Populated /etc with preset unit settings.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: Queued start job for default target graphical.target.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Created slice system-getty.slice - Slice /system/getty.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Created slice system-modprobe.slice - Slice /system/modprobe.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Created slice user.slice - User and Session Slice.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Started systemd-ask-password-consol…quests to Console Directory Watch.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Started systemd-ask-password-wall.p… Requests to Wall Directory Watch.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target cryptsetup.target - Local Encrypted Volumes.
Apr 23 xxxxxxxxxxxxxsystemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target integritysetup.targe…Local Integrity Protected Volumes.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target paths.target - Path Units.
Apr 23 xxxxxxxxxxxxxsystemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target remote-cryptsetup.target - Remote Encrypted Volumes.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target remote-fs.target - Remote File Systems.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target remote-veritysetup.t…- Remote Verity Protected Volumes.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target slices.target - Slice Units.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target swap.target - Swaps.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target veritysetup.target - Local Verity Protected Volumes.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Listening on systemd-initctl.socket… initctl Compatibility Named Pipe.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Listening on systemd-journald-dev-l…ocket - Journal Socket (/dev/log).
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Listening on systemd-journald.socket - Journal Socket.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Listening on systemd-networkd.socket - Network Service Netlink Socket.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Mounting dev-hugepages.mount - Huge Pages File System...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting nftables.service - nftables...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-journald.service - Journal Service...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-network-generator.… units from Kernel command line...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-remount-fs.service…nt Root and Kernel File Systems...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-sysctl.service - Apply Kernel Variables...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Mounted dev-hugepages.mount - Huge Pages File System.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Finished systemd-network-generator.…rk units from Kernel command line.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Finished systemd-remount-fs.service…ount Root and Kernel File Systems.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-firstboot.service - First Boot Wizard...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Finished systemd-sysctl.service - Apply Kernel Variables.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Started systemd-journald.service - Journal Service.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-journal-flush.serv…h Journal to Persistent Storage...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Finished systemd-firstboot.service - First Boot Wizard.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target first-boot-complete.target - First Boot Complete.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-sysusers.service - Create System Users...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Finished systemd-sysusers.service - Create System Users.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Finished nftables.service - nftables.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target network-pre.target - Preparation for Network.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-tmpfiles-setup-dev…ate Static Device Nodes in /dev...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Finished systemd-journal-flush.serv…ush Journal to Persistent Storage.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Finished systemd-tmpfiles-setup-dev…reate Static Device Nodes in /dev.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target local-fs-pre.target …reparation for Local File Systems.
Apr 23 xxxxxxxxxxxxxsystemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target local-fs.target - Local File Systems.
Apr 23 xxxxxxxxxxxxxsystemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-machine-id-commit.… a transient machine-id on disk...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-tmpfiles-setup.ser… Volatile Files and Directories...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-networkd.service - Network Configuration...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Finished systemd-tmpfiles-setup.ser…te Volatile Files and Directories.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-resolved.service - Network Name Resolution...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-update-utmp.servic…rd System Boot/Shutdown in UTMP...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Finished systemd-update-utmp.servic…cord System Boot/Shutdown in UTMP.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Started systemd-networkd.service - Network Configuration.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-networkd-wait-onli…it for Network to be Configured...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Started systemd-resolved.service - Network Name Resolution.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target network.target - Network.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target nss-lookup.target - Host and Network Name Lookups.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target sysinit.target - System Initialization.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Started apt-daily.timer - Daily apt download activities.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Started apt-daily-upgrade.timer - D… apt upgrade and clean activities.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Started dpkg-db-backup.timer - Daily dpkg database backup timer.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Started e2scrub_all.timer - Periodi…etadata Check for All Filesystems.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Started systemd-tmpfiles-clean.time… Cleanup of Temporary Directories.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target timers.target - Timer Units.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Listening on dbus.socket - D-Bus System Message Bus Socket.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting docker.socket - Docker Socket for the API...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Listening on docker.socket - Docker Socket for the API.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target sockets.target - Socket Units.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target basic.target - Basic System.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting containerd.service - containerd container runtime...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting dbus.service - D-Bus System Message Bus...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-logind.service - User Login Management...
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]:          Starting systemd-user-sessions.service - Permit User Sessions...
Apr 23 xxxxxxxxxxxxx  systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Finished systemd-user-sessions.service - Permit User Sessions.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Started dbus.service - D-Bus System Message Bus.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Started console-getty.service - Console Getty.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Reached target getty.target - Login Prompts.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Started systemd-logind.service - User Login Management.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: [  OK  ] Started containerd.service - containerd container runtime.
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: 
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: Debian GNU/Linux 12 docker pts/0
Apr 23 xxxxxxxxxxxxx systemd-nspawn[xxxxxxxxxxxxx]: 
lines 52-92/92 (END)

Docker vs Containerd: A Detailed Comparison.

ok now we are talking

root@xxxxxxxx[~]# jlmkr exec docker bash -c ‘echo test; echo $RANDOM;’

test
1735
root@xxxxxxxx[~]# jlmkr exec docker bash -c docker

Usage: docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Common Commands:
run Create and run a new container from an image
exec Execute a command in a running container
ps List containers
build Build an image from a Dockerfile
pull Download an image from a registry
push Upload an image to a registry
images List images
login Log in to a registry
logout Log out from a registry
search Search Docker Hub for images
version Show the Docker version information
info Display system-wide information

Management Commands:
builder Manage builds
buildx* Docker Buildx
compose* Docker Compose
container Manage containers
context Manage contexts
image Manage images
manifest Manage Docker image manifests and manifest lists
network Manage networks
plugin Manage plugins
system Manage Docker
trust Manage trust on Docker images
volume Manage volumes

Swarm Commands:
swarm Manage Swarm

Commands:
attach Attach local standard input, output, and error streams to a running container
commit Create a new image from a container’s changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes to files or directories on a container’s filesystem
events Get real time events from the server
export Export a container’s filesystem as a tar archive
history Show the history of an image
import Import the contents from a tarball to create a filesystem image
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
logs Fetch the logs of a container
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers
rmi Remove one or more images
save Save one or more images to a tar archive (streamed to STDOUT by default)
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
wait Block until one or more containers stop, then print their exit codes

Global Options:
–config string Location of client config files (default “/root/.docker”)
-c, --context string Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with “docker context use”)
-D, --debug Enable debug mode
-H, --host list Daemon socket to connect to
-l, --log-level string Set the logging level (“debug”, “info”, “warn”, “error”, “fatal”) (default “info”)
–tls Use TLS; implied by --tlsverify
–tlscacert string Trust certs signed only by this CA (default “/root/.docker/ca.pem”)
–tlscert string Path to TLS certificate file (default “/root/.docker/cert.pem”)
–tlskey string Path to TLS key file (default “/root/.docker/key.pem”)
–tlsverify Use TLS and verify the remote
-v, --version Print version information and quit

Run ‘docker COMMAND --help’ for more information on a command.

For more help on how to use Docker, head to Docker Docs
root@xxxxxxxx[~]#


:rofl:

If you’ve encountered the error “docker-compose command not found” on or about April 2, 2024, it means you’re using the v1 Docker Compose command.

GitHub deprecated v1, and you need to change the command from, e.g., docker-compose build to docker compose build (remove the dash)

There are other changes too, and your workflows and scripts might need migrations to v2. Take a look at the official Docker Compose V2 Migration Guide for guidance

Change docker-compose to docker compose it’s work

Are you running 23.10? Because Docker has been removed in 23.10 due to an upstream switch from k3s from docker to containerd as runtime.

If you want to run native docker you have two options:

  1. run a linux vm and run docker inside the vm
  2. the jailmaker script from Jip-Hop.

Option 1 is fully supported by truenas, Option 2 as i believe is not officially supported and a more “hacky” way.

Try this:
find / -name “docker.sock”

:thinking:

Example

A use of this is making files available in a jail for it to use or serve, such as media files in Plex/Jellyfin: Example: --bind='/mnt/tank/content/:/media' will make any files inside the content dataset of the tank pool available inside the jail’s /media folder. To visualise or test this you can copy some files to /mnt/tank/content/ such as media1.mp4, media2.mkv and photo.jpg. Then change directory to that folder inside the jail cd /media and list files in that directory ls -l where those files should appear.

Warning

Do not bind your TrueNAS system directories (/root /mnt /dev /bin /etc /home /var /usr or anything else in the root directory) to your jail as this can cause TrueNAS to lose permissions and render your TrueNAS system unusable. Best practice is to create a dataset in a pool which also allows zfs, raidz, permissions, and backups to function. E.g creating a websites dataset in a pool named tank then binding --bind='/mnt/tank/websites/websitename/:/var/www/websitename/'


so solution was

jlmkr shell docker

at this point you can do all your docker magic e.g.

docker version

Anyway yes it’s using the latest docker

more roadblocks

https://www.reddit.com/r/selfhosted/comments/1bm9vbj/fyi_docker_version_26_breaks_portainer/

new docker version broke portainer? nani

# find / -name "docker.sock"
/run/docker.sock

stuck here, any help? :pray:

just need to reach the dataset where i have my docker compose yamls so i can then do a docker compose up.

but i can’t do that because when ls or cd, i cannot find or change directory to where my docker compose yaml is located. really no idea at this point.

back in qts, all this was already setup in advance, so you can begin just using it right away.

but in truenas i had to do everything from scratch. it’s easy for a newbie like me :smiling_face_with_tear:

Docker runs its containers on another bridge (172.x.x.x). I think vb-docker is that.

1 Like

Yes, shell into the sandbox.

Meanwhile, beware:

1 Like

You need too mount the data set in the jail config. It’s a bit like how you host mount docker.

So you host mount into the jail, then into the docker.

jlmkr edit docker

Then jlmkr restart docker

1 Like

yeah i sus it might have to do with mount but not sure how.

as for the jlmkr edit docker

people not familiar with nano

Using the commands Ctrl+O and Ctrl+X , you can easily save the Nano file or exit the Nano editor. But be careful; you must have written permission to do these for all the files and directories you are working on, and then only you can make any changes in the nano editor.

How to Save and Exit Nano? [Nano Save and Exit].

anyway i take it u do the bind mount here?

jlmkr edit docker

not sure what to type but ill check if jailmaker left some documentation or not :sweat_smile:

1 Like

ok figured it out

go to truenas shell

jlmkr edit docker

then read the screenshot mention about binds. just slot in that bind command in my example and modify accordingly.

i know they mentioned it, but can’t they also add examples of what that may look like. newbs like me are seriously clueless :smiling_face_with_tear:

i’ll have to read that carefully. ty for the reminder. sorry i’m tired. i’ve been at this all day :sob:

ok so changed the thing, and restarted. when it loads you can see the bind is shown so you know the change is active.

so it should allow me to ls and change directory and proceed to docker compose up my docker compose yaml config file.