This is a Docker container for MythTV Backend.
MythTV Setup is accessed through a modern web browser.
MythTV is an Open Source DVR that started development in 2002. It contains many features found in many commercial DVR solutions. MythTV can receive original TV programming from over the air or cable TV systems and integrates with various guide data services.
This MythTV docker container aims to ease MythTV configuration by making it easy to configure the system using modern web browsers. MythTV can be complex to configure due to the requirement of needing a GUI to configure the backend. The other thing that can make MythTV difficult is the setup process requires the backend process to be stopped. Since service supervisors such as runit and S6 try to keep the services from stopping, this image uses a config mode to prevent mythbackend from starting.
IMPORTANT: When creating the container, the --hostname flag must be used to set a hostname in the image. This is because MythTV binds itself to the hostname used to configure the database. The option --net=host must also be used because mythbackend needs to be accessible on the public network so mythfrontend can properly locate it.
NOTE: The Docker command provided in this quick start is given as an example and parameters should be adjusted to your need.
Launch the MythTV docker container with the following command:
docker run -d \
--name=mythbackend \
-v /docker/appdata/mythtv/config:/home/mythtv \
-v /docker/appdata/mythtv/data:/var/lib/mysql \
-v /docker/appdata/mythtv/media:/var/lib/mythtv \
--hostname=mythbackend --net=host \
sammonsjl/mythtv:29-fixes
Where:
/docker/appdata/mythtv/config
: This is where MythTV stores its configuration./docker/appdata/mythtv/data
: This is where MythTV stores it's MariaDB database./docker/appdata/mythtv/media
: This is where MythTV stores it's media files such as recordings.Browse to http://your-host-ip:6570
to access the Mate Desktop GUI. From here MythTV can be configured using the MythTV Backend Setup shortcut. MythTV can be also be tested using the MythTV Backend Startup shortcut. Setting the variable CONFIG_MODE=0 will disable the GUI and properly configure S6 to control mythbackend startup.
docker run [-d] \
--name=mythbackend \
[-e <VARIABLE_NAME>=<VALUE>]... \
[-v <HOST_DIR>:<CONTAINER_DIR>[:PERMISSIONS]]... \
[---hostname=<HOSTNAME>]... --net=host \
sammonsjl/mythtv:29-fixes
Parameter | Description |
---|---|
-d | Run the container in background. If not set, the container runs in foreground. |
-e | Pass an environment variable to the container. See the Environment Variables section for more details. |
-v | Set a volume mapping (allows to share a folder/file between the host and the container). See the Data Volumes section for more details. |
To customize some properties of the container, the following environment
variables can be passed via the -e
parameter (one for each variable). Value
of this parameter has the format <VARIABLE_NAME>=<VALUE>
.
Variable | Description | Default |
---|---|---|
USERID |
ID of the user the application runs as. See User/Group IDs to better understand when this should be set. | 120 |
GROUPID |
ID of the group the application runs as. See User/Group IDs to better understand when this should be set. | 121 |
TZ |
TimeZone of the container. Timezone can also be set by mapping /etc/localtime between the host and the container. |
America/Chicago" |
CONFIG_MODE |
When set to 1 , The mythbackend service will be disabled and a Mate Desktop will be started at: http://your-host-ip:6570 . |
1 |
The following table describes data volumes used by the container. The mappings
are set via the -v
parameter. Each mapping is specified with the following
format: <HOST_DIR>:<CONTAINER_DIR>[:PERMISSIONS]
.
Container path | Permissions | Description |
---|---|---|
/home/mythtv |
rw | This is where MythTV stores its configuration. |
/var/lib/mysql |
rw | This is where MythTV stores it's MariaDB database. |
/var/lib/mythtv |
rw | This is where MythTV stores it's media files such as recordings. |
Here is the list of ports used by the container. They will be mapped to the host
via the --net=host
parameter.
Port | Description |
---|---|
6506 | MariaDB instance accessed by Mythfrontend. |
6543 | Port Mythbackend runs on. |
6544 | Mythbackend status port. Also where MythTV WebFrontend runs. |
6554 | Web Socket Port. |
6570 | Port used to configure MythTV via a Mate Desktop. |
6580 | Port used to access the MythWeb GUI. |
As seen, environment variables, volume mappings and port mappings are specified while creating the container.
The following steps describe the method used to add, remove or update parameter(s) of an existing container. The generic idea is to destroy and re-create the container:
docker stop mythbackend
docker rm mythbackend
docker run
command, by adjusting
parameters as needed.NOTE: Since all application's data is saved under the various volumes, destroying and re-creating a container is not a problem: nothing is lost and the application comes back with the same state (as long as the volume mappings remain the same).
Here is an example of a docker-compose.yml
file that can be used with
Docker Compose.
Make sure to adjust according to your needs.
version: '3'
services:
mythbackend:
build: .
environment:
- CONFIG_MODE=1
volumes:
- config:/home/mythtv:nocopy
- data:/var/lib/mysql:nocopy
- media:/var/lib/mythtv:nocopy
- ./shared:/shared
hostname: mythbackend
network_mode: "host"
volumes:
config:
data:
media:
If the system on which the container runs doesn't provide a way to easily update the Docker image, the following steps can be followed:
docker pull sammonsjl/mythtv:29-fixes
docker stop mythbackend
docker rm mythbackend
docker run
command.For owners of a Synology NAS, the following steps can be use to update a container image.
sammonsjl/mythtv
).29-fixes
tag.For unRAID, a container image can be updated by following these steps:
When using data volumes (-v
flags), permissions issues can occur between the
host and the container. For example, the user within the container may not
exists on the host. This could prevent the host from properly accessing files
and folders on the shared volume.
To avoid any problem, you can specify the user the application should run as.
This is done by passing the user ID and group ID to the container via the
USERID
and GROUPID
environment variables.
To find the right IDs to use, issue the following command on the host, with the user owning the data volume on the host:
id <username>
Which gives an output like this one:
uid=1000(myuser) gid=1000(myuser) groups=1000(myuser),4(adm),24(cdrom),27(sudo),46(plugdev),113(lpadmin)
The value of uid
(user ID) and gid
(group ID) are the ones that you should
be given the container.
The graphical interface of the application can be accessed via:
http://<HOST IP ADDR>:6570
To get shell access to a the running container, execute the following command:
docker exec -it CONTAINER /bin/bash
Where CONTAINER
is the ID or the name of the container used during its
creation (e.g. mythbackend
).
Having troubles with the container or have questions? Please create a new issue.