TC Docker doesn't survive a reboot of the host system / Alert time-stamping incorrect

Joined
Jan 4, 2014
Messages
1,644
Not sure if this has been reported (I couldn't see it in Jira) or raised in discussion in the TC forum, but I've noticed that the TC Docker container doesn't automatically restart if the Ubuntu host is rebooted. It's not so much a bug. It's more a documentation issue. Extract from the installation guide:

After installing docker, fetch the docker image. This can be done in the Command Line Interface (CLI) by typing docker run --detach -v "/hostdirectory:/data" -p portnumber:80 -p sslport:443 ixsystems/truecommand:latest where hostdirectory is a directory on the host machine that is used as the data directory for the docker container, portnumber is the desired port number to access the web interface, and sslportnumber is the desired port number to securely access the web interface through SSL. Although there are different ways to run a docker container, make sure to use -v/hostdirectory:/data in the command.

The highlighted directives below do two things:
  1. Ensure that the TC container restarts after a reboot of the host system; and
  2. Facilitate referencing the container. The container is given a sensible name rather than the randomly generated ones like 'nervous_khorana' (which, btw, doesn't instil me with any confidence whatsoever).
run --detach -v "/hostdirectory:/data" -p portnumber:80 -p sslport:443 --restart always --name=truecommand ixsystems/truecommand:latest
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
You might want to try this systemd service:
Code:
# https://blog.container-solutions.com/running-docker-containers-with-systemd
#
[Unit]
Description=Truecommand Container
After=docker.service
Requires=docker.service

[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull ixsystems/truecommand
ExecStart=/usr/bin/docker run --rm --name %n -v "/var/lib/truecommand:/data" -p 80:80 -p 443:443 ixsystems/truecommand

[Install]
WantedBy=multi-user.target
 
Joined
Jan 4, 2014
Messages
1,644
Alerts are also time-stamped incorrectly in TC. I believe this is because the time in the container isn't correct. This version of the run command seems to fix it.
sudo docker run --detach -v "/hostdirectory:/data" -p portnumber:80 -p sslport:443 --restart always --name=truecommand -e TZ=timezone ixsystems/truecommand:latest

The List of TZ Database Time Zones documentation on Wikipedia contains further information on the different Timezones that can be set. For example:
sudo docker run --detach -v "/tc-data:/data" -p 8080:80 -p 8081:443 --restart always --name=truecommand -e TZ=Australia/Perth ixsystems/truecommand:latest
 
Last edited:

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
@Basil Hendroff I can confirm the startup problem unless you pass the --restart always parameter. But I cannot reproduce your problem with the timestamps.

I created the Ubuntu VM I use by the install ISO and of course set the "System Clock" parameter to UTC for the VM. Then configured ntpd and timezone inside the VM, so the VM has got correct and synchronized CEST.

I start the docker container without extra timezone settings and it seems to simply use those of the host Ubuntu. See screenshots, one from the FreeNAS UI, the other from Truecommand. Other than 12/24h format difference same time.

Kind regards,
Patrick

Local.png Truecommand.png
 
Joined
Jan 4, 2014
Messages
1,644
I use by the install ISO
Not sure what you mean by this? I started with the docker run command. The first time I ran it, it pulled down the TC image. Did you do the same?
For instance, I note from this article 5 ways to change time in Docker container, the fifth way configures the NTP service in the image.

and of course set the "System Clock" parameter to UTC for the VM. Then configured ntpd and timezone inside the VM, so the VM has got correct and synchronized CEST.
I checked that the VM had the correct time before I fetched the TC image.

screenshot.325.png


I start the docker container without extra timezone settings and it seems to simply use those of the host Ubuntu. See screenshots, one from the FreeNAS UI, the other from Truecommand. Other than 12/24h format difference same time.
Strange. If I didn't use the extra timezone settings, it appeared (if I recall correctly - I seem to remember an eight-hour difference) that UTC time-stamping took precedence.
 
Last edited:

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
I meant to describe that I did a regular Ubuntu install from the 18.04 install ISO and configured that properly, first.
Some people use special made images for container environments, so I just wanted to make clear what I am running.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
Main difference I can spot: I disabled systemd-timesyncd, because when did ntpd break? I hate it when people replace perfectly working software for no reason. And AFAIK systemd-timesync does only speak SNTP, so it cannot adjust the kernel clock frequency, just continuously set the time.
So of course I run ntpd on all my systems including VMs.
 
Joined
Jan 4, 2014
Messages
1,644
Joined
Jan 4, 2014
Messages
1,644
Main difference I can spot: I disabled systemd-timesyncd, because when did ntpd break? I hate it when people replace perfectly working software for no reason. And AFAIK systemd-timesync does only speak SNTP, so it cannot adjust the kernel clock frequency, just continuously set the time.
So of course I run ntpd on all my systems including VMs.
So does that explain why I had to use the extra timezone settings?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
Sorry, but you will have to try that ;)
I don't run systemd-timesyncd as I said.

systemctl disable systemd-timesyncd
apt-get install ntp

Check with ntpq that you are synchronized.
 
Joined
Jan 4, 2014
Messages
1,644
Sorry, but you will have to try that ;)
I don't run systemd-timesyncd as I said.

systemctl disable systemd-timesyncd
apt-get install ntp

Check with ntpq that you are synchronized.
OK. Thanks!
 
Joined
Jan 4, 2014
Messages
1,644
I disabled systemd-timesyncd, because when did ntpd break?
I was curious about this. After some googling, I get the impression that ntpd has both the time server and client components, while systemd-timesyncd is just an NTP client.
 
Top