The command in the TrueCommand Guide:
docker run --detach -v "/hostdirectory:/data" -p portnumber:80 -p sslport:443 ixsystems/truecommand:latest
A practical example:
sudo docker run --detach -v "/tc-data:/data" -p 8080:80 -p 8081:443 ixsystems/truecommand:latest
There are a number of issues with this:
- The data is lost if the Ubuntu VM is destroyed;
- The time in the container does not correspond to local time. The result is incorrect time stamping of alerts in TC.
- The command is not persistent. It does not survive a reboot.
- Does not facilitate container referencing.
Reboot survival and container referencing
sudo docker run --detach -v "/hostdirectory:/data" -p portnumber:80 -p sslport:443 --restart always --name=truecommand ixsystems/truecommand:latest
For example:
sudo docker run --detach -v "/tc-data:/data" -p 7080:80 -p 7081:443 --restart always --name=truecommand ixsystems/truecommand:latest
Time
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 7080:80 -p 7081:443 --restart always --name=truecommand -e TZ=Australia/Perth ixsystems/truecommand:latest
FreeNAS storage
Two steps on the FreeNAS server:
- Create the dataset
- Create the NFS share
Step 1: Create the dataset
Step 2: Create the NFS share
Three steps on the Ubuntu VM:
- Install the NFS client
- Map the FreeNAS share to the mount point
- Start the docker container using the mount point
- Set up a persistent mount
Step 1: Install the NFS client
sudo apt-get install nfs-common
Step 2: Map the FreeNAS share to the mount point.
sudo mount 10.1.1.20:/mnt/tank/nfs/truecommand $HOME/truecommand/data
Note: To dismount the share:
sudo umount $HOME/truecommand/data
To list the mounted share:
mount -l
Step 3: Start the docker container using the mount point
For example:
sudo docker run --detach -v "$HOME/truecommand/data:/data" -p 8080:80 -p 8081:443 --restart always --name=truecommand -e TZ=Australia/Perth ixsystems/truecommand:latest
Step 4: Set up a persistent mount
For the mount to survive a reboot, add a line to /etc/fstab. For example:
# <file system> <mount point> <type> <options> <dump> <pass> 10.1.1.20:/mnt/tank/nfs/truecommand /home/administrator/truecommand/data nfs defaults 0 0
Docker Compose
A docker-compose.yml equivalent to the run command.
version: '3.3' services: truecommand: volumes: - '/home/administrator/truecommand/data:/data' ports: - '7080:80' - '7081:443' restart: always container_name: truecommand environment: - TZ=Australia/Perth image: ixsystems/truecommand
References
Comments