├── .github └── workflows │ └── build.yml ├── Dockerfile ├── README.md └── docker-compose-example.yml /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | workflow_dispatch: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | schedule: 9 | - cron: "0 0 * * *" 10 | 11 | jobs: 12 | collect_tags: 13 | runs-on: ubuntu-latest 14 | outputs: 15 | matrix: ${{ steps.set-matrix.outputs.matrix }} 16 | will_push: ${{ steps.set-will-push.outputs.will_push }} 17 | steps: 18 | - run: | 19 | MY_LAST_PUSH=$(curl -L -s --max-time 10 'https://registry.hub.docker.com/v2/repositories/${{ secrets.DOCKERHUB_USERNAME }}/tinymediamanager/tags?page_size=1024'|jq -r '[."results" | sort_by(.tag_last_pushed)[]][-1].tag_last_pushed') 20 | if [ $MY_LAST_PUSH == "null" ]; then MY_LAST_PUSH="2021"; fi 21 | NEW_TAGS=$(curl -L -s --max-time 10 'https://registry.hub.docker.com/v2/repositories/romancin/tinymediamanager/tags?page_size=1024'| jq -r '[."results"[] | select(.tag_last_pushed |. >$s ) | select(.name|contains("dev")|not) | {name: .name} ] | tostring' --arg s $MY_LAST_PUSH) 22 | 23 | PUSH_TO_DOCKER_HUB=true 24 | if [ $NEW_TAGS == "[]" ] 25 | then 26 | NEW_TAGS=$(echo '[{"name":"latest"},{"name":"latest-v4"}]') 27 | PUSH_TO_DOCKER_HUB=false 28 | fi 29 | 30 | echo "push_to_docker_hub=$(echo $PUSH_TO_DOCKER_HUB)" >> $GITHUB_ENV 31 | 32 | NEW_TAGS=$(echo $NEW_TAGS | sed 's/\"/\\"/g') 33 | echo "new_tags=$(echo $NEW_TAGS)" >> $GITHUB_ENV 34 | - id: set-matrix 35 | name: set tag values 36 | run: echo "::set-output name=matrix::{\"tag\":${{env.new_tags}}}" 37 | - id: set-will-push 38 | name: set will_push 39 | run: echo "::set-output name=will_push::${{env.push_to_docker_hub}}" 40 | 41 | build: 42 | needs: collect_tags 43 | runs-on: ubuntu-latest 44 | strategy: 45 | matrix: ${{fromJson(needs.collect_tags.outputs.matrix)}} 46 | steps: 47 | - name: Build ${{ matrix.tag.name }} 48 | uses: actions/checkout@v2 49 | - name: Login to DockerHub 50 | uses: docker/login-action@v1 51 | with: 52 | username: ${{ secrets.DOCKERHUB_USERNAME }} 53 | password: ${{ secrets.DOCKERHUB_TOKEN }} 54 | - name: Build and push 55 | uses: docker/build-push-action@v2 56 | with: 57 | context: . 58 | build-args: | 59 | BASE_IMG=romancin/tinymediamanager:${{ matrix.tag.name }} 60 | push: ${{needs.collect_tags.outputs.will_push}} 61 | tags: ${{ secrets.DOCKERHUB_USERNAME }}/tinymediamanager:${{ matrix.tag.name }} 62 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # TinyMediaManager Dockerfile 3 | # 4 | ARG BASE_IMG=romancin/tinymediamanager:latest 5 | FROM $BASE_IMG 6 | 7 | # Install Chinese Fonts 8 | RUN wget https://mirrors.aliyun.com/alpine/edge/testing/x86_64/font-wqy-zenhei-0.9.45-r3.apk -O wqy.apk \ 9 | && apk add --allow-untrusted wqy.apk \ 10 | && rm -rf /tmp/wqy.apk \ 11 | && sed -i 's/\[ ! -f \/config\/tmm.jar \]; then/[ ! -f \/config\/tmm.jar ] || [ ! -f \/config\/tmm.tar.gz ] || ! cmp \/defaults\/tmm.tar.gz \/config\/tmm.tar.gz; then/g' /etc/cont-init.d/tmm.sh 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # tinymediamanager-docker 2 | ## V3 and V4 were no longer maintained, please visit version 5: [https://github.com/dzhuang/tinymediamanager5-docker](https://github.com/dzhuang/tinymediamanager5-docker) 3 | 4 | **注意:** v3 and v4 were no longer be maintained. v3和v4版已经不再维护。 5 | 6 | A repository for creating a docker container including TinyMediaManager with GUI interface (**with Chinese and Japanese fonts**). 7 | 8 | ## modification to the original repo 9 | - Add Chinese and Japanese fonts support out of the box (中文支持开箱即用) 10 | - Quick fix for [bug](https://github.com/dzhuang/tinymediamanager-docker/issues/13) that image change did not result in changes of version in running containers . Need to test if version change between v3 and v4 works and will submit PR to original repo. (修复image升级/变化后,容器实际运行的tmm版本未变化的[bug](https://github.com/dzhuang/tinymediamanager-docker/issues/13),跨V3和V4的版本切换未测试,请谨慎使用) 11 | - Demo docker compose file that enable container auto upgrade (支持自动升级版本的docker compose示例文件). 12 | 13 | The build also fixes the version not updated issue. 14 | To use this build, please use `dzhuang/tinymediamanager:v4-latest`. 15 | 16 | This repo tries to sync the [docker hub builds](https://hub.docker.com/r/dzhuang/tinymediamanager) with upstream (romancin/tinymediamanager) with the same tag (version number). Visit [dzhuang/tinymediamanager/tags](https://hub.docker.com/r/dzhuang/tinymediamanager/tags) 17 | for more information. 18 | 19 | ![docker pulls](https://img.shields.io/docker/pulls/dzhuang/tinymediamanager.svg) ![docker stars](https://img.shields.io/docker/stars/dzhuang/tinymediamanager.svg) 20 | 21 | Latest versions: 22 | 23 | ![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/dzhuang/tinymediamanager/v3) ![docker size](https://img.shields.io/docker/image-size/dzhuang/tinymediamanager/v3) 24 | ![Docker Image Version (latest semver)](https://img.shields.io/docker/v/dzhuang/tinymediamanager/v4) ![docker size](https://img.shields.io/docker/image-size/dzhuang/tinymediamanager/v4) 25 | 26 | If you are migrating from v3 to v4, please make a backup before. I recommend you create a new host directory to map the new config, and copy the "/config/data" folder from v3 version to it. 27 | Take a look at the official upgrade documentation here: 28 | https://www.tinymediamanager.org/docs/upgrade-v4 29 | 30 | Since credit goes to [romancin](https://github.com/romancin/tinymediamanager-docker) due to his great job, you can invite him a beer if you want ;) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X2CT2SWQCP74U) 31 | 32 | This is a completely funcional Docker image with TinyMediaManager. 33 | 34 | Based on Alpine Linux, which provides a very small size. 35 | 36 | Tested and working on Synology and QNAP, but should work on any x86_64 devices. 37 | 38 | Thanks to @jlesage for a great base image for GUI apps. 39 | 40 | Instructions: 41 | - Map any local port to 5800 for web access 42 | - Map any local port to 5900 for VNC access 43 | - Map a local volume to /config (Stores configuration data) 44 | - Map a local volume to /media (Access media files) 45 | 46 | Sample run command: 47 | 48 | ```bash 49 | docker run -d --name=tinymediamanager \ 50 | -v /share/Container/tinymediamanager/config:/config \ 51 | -v /share/Container/tinymediamanager/media:/media \ 52 | -e GROUP_ID=1000 -e USER_ID=0 -e TZ=Asia/Hong_Kong \ 53 | -p 5800:5800 \ 54 | -p 5900:5900 \ 55 | dzhuang/tinymediamanager:latest-v5 56 | ``` 57 | 58 | Browse to `http://your-host-ip:5800` to access the TinyMediaManager GUI. 59 | 60 | ### Image TAGs available 61 | 62 | | TAG | Description | 63 | |-----------|----------------------------------------------| 64 | |`latest`| Latest available version of **TMM v3**. **Recommended if you don't want to pay**. | 65 | |`latest-v4`| Latest available version of **TMM v4**. [Free for 50 movies, 10 TV series and about 50 API calls](https://www.tinymediamanager.org/blog/v4-future/). | 66 | |`vX.X.X` | Points directly to one of the TMM versions available, v3 or v4 | 67 | 68 | ### Environment Variables 69 | 70 | To customize some properties of the container, the following environment 71 | variables can be passed via the `-e` parameter (one for each variable). Value 72 | of this parameter has the format `=`. 73 | 74 | | Variable | Description | Default | 75 | |----------------|----------------------------------------------|---------| 76 | |`USER_ID`| ID of the user the application runs as. See [User/Group IDs](#usergroup-ids) to better understand when this should be set. | `1000` | 77 | |`GROUP_ID`| ID of the group the application runs as. See [User/Group IDs](#usergroup-ids) to better understand when this should be set. | `1000` | 78 | |`SUP_GROUP_IDS`| Comma-separated list of supplementary group IDs of the application. | (unset) | 79 | |`UMASK`| Mask that controls how file permissions are set for newly created files. The value of the mask is in octal notation. By default, this variable is not set and the default umask of `022` is used, meaning that newly created files are readable by everyone, but only writable by the owner. See the following online umask calculator: http://wintelguy.com/umask-calc.pl | (unset) | 80 | |`TZ`| [TimeZone] of the container. Timezone can also be set by mapping `/etc/localtime` between the host and the container. | `Etc/UTC` | 81 | |`KEEP_APP_RUNNING`| When set to `1`, the application will be automatically restarted if it crashes or if user quits it. | `0` | 82 | |`APP_NICENESS`| Priority at which the application should run. A niceness value of -20 is the highest priority and 19 is the lowest priority. By default, niceness is not set, meaning that the default niceness of 0 is used. **NOTE**: A negative niceness (priority increase) requires additional permissions. In this case, the container should be run with the docker option `--cap-add=SYS_NICE`. | (unset) | 83 | |`CLEAN_TMP_DIR`| When set to `1`, all files in the `/tmp` directory are delete during the container startup. | `1` | 84 | |`DISPLAY_WIDTH`| Width (in pixels) of the application's window. | `1280` | 85 | |`DISPLAY_HEIGHT`| Height (in pixels) of the application's window. | `768` | 86 | |`SECURE_CONNECTION`| When set to `1`, an encrypted connection is used to access the application's GUI (either via web browser or VNC client). See the [Security](#security) section for more details. | `0` | 87 | |`VNC_PASSWORD`| Password needed to connect to the application's GUI. See the [VNC Password](#vnc-password) section for more details. | (unset) | 88 | |`X11VNC_EXTRA_OPTS`| Extra options to pass to the x11vnc server running in the Docker container. **WARNING**: For advanced users. Do not use unless you know what you are doing. | (unset) | 89 | |`ENABLE_CJK_FONT`| When set to `1`, open source computer font `WenQuanYi Zen Hei` is installed. This font contains a large range of Chinese/Japanese/Korean characters. | `0` | 90 | 91 | ### Data Volumes 92 | 93 | The following table describes data volumes used by the container. The mappings 94 | are set via the `-v` parameter. Each mapping is specified with the following 95 | format: `:[:PERMISSIONS]`. 96 | 97 | | Container path | Permissions | Description | 98 | |-----------------|-------------|-------------| 99 | |`/config`| rw | This is where the application stores its configuration, log and any files needing persistency. | 100 | |`/media`| rw | This is where your media files are stored. | 101 | 102 | ### Ports 103 | 104 | Here is the list of ports used by the container. They can be mapped to the host 105 | via the `-p` parameter (one per port mapping). Each mapping is defined in the 106 | following format: `:`. The port number inside the 107 | container cannot be changed, but you are free to use any port on the host side. 108 | 109 | | Port | Mapping to host | Description | 110 | |------|-----------------|-------------| 111 | | 5800 | Mandatory | Port used to access the application's GUI via the web interface. | 112 | | 5900 | Optional | Port used to access the application's GUI via the VNC protocol. Optional if no VNC client is used. | 113 | 114 | ## User/Group IDs 115 | 116 | When using data volumes (`-v` flags), permissions issues can occur between the 117 | host and the container. For example, the user within the container may not 118 | exists on the host. This could prevent the host from properly accessing files 119 | and folders on the shared volume. 120 | 121 | To avoid any problem, you can specify the user the application should run as. 122 | 123 | This is done by passing the user ID and group ID to the container via the 124 | `USER_ID` and `GROUP_ID` environment variables. 125 | 126 | To find the right IDs to use, issue the following command on the host, with the 127 | user owning the data volume on the host: 128 | 129 | id 130 | 131 | Which gives an output like this one: 132 | ``` 133 | uid=1000(myuser) gid=1000(myuser) groups=1000(myuser),4(adm),24(cdrom),27(sudo),46(plugdev),113(lpadmin) 134 | ``` 135 | 136 | The value of `uid` (user ID) and `gid` (group ID) are the ones that you should 137 | be given the container. 138 | 139 | ## Security 140 | 141 | By default, access to the application's GUI is done over an unencrypted 142 | connection (HTTP or VNC). 143 | 144 | Secure connection can be enabled via the `SECURE_CONNECTION` environment 145 | variable. See the [Environment Variables](#environment-variables) section for 146 | more details on how to set an environment variable. 147 | 148 | When enabled, application's GUI is performed over an HTTPs connection when 149 | accessed with a browser. All HTTP accesses are automatically redirected to 150 | HTTPs. 151 | 152 | When using a VNC client, the VNC connection is performed over SSL. Note that 153 | few VNC clients support this method. [SSVNC] is one of them. 154 | 155 | [SSVNC]: http://www.karlrunge.com/x11vnc/ssvnc.html 156 | 157 | ### Certificates 158 | 159 | Here are the certificate files needed by the container. By default, when they 160 | are missing, self-signed certificates are generated and used. All files have 161 | PEM encoded, x509 certificates. 162 | 163 | | Container Path | Purpose | Content | 164 | |---------------------------------|----------------------------|---------| 165 | |`/config/certs/vnc-server.pem` |VNC connection encryption. |VNC server's private key and certificate, bundled with any root and intermediate certificates.| 166 | |`/config/certs/web-privkey.pem` |HTTPs connection encryption.|Web server's private key.| 167 | |`/config/certs/web-fullchain.pem`|HTTPs connection encryption.|Web server's certificate, bundled with any root and intermediate certificates.| 168 | 169 | **NOTE**: To prevent any certificate validity warnings/errors from the browser 170 | or VNC client, make sure to supply your own valid certificates. 171 | 172 | **NOTE**: Certificate files are monitored and relevant daemons are automatically 173 | restarted when changes are detected. 174 | 175 | ### VNC Password 176 | 177 | To restrict access to your application, a password can be specified. This can 178 | be done via two methods: 179 | * By using the `VNC_PASSWORD` environment variable. 180 | * By creating a `.vncpass_clear` file at the root of the `/config` volume. 181 | This file should contains the password in clear-text. During the container 182 | startup, content of the file is obfuscated and moved to `.vncpass`. 183 | 184 | The level of security provided by the VNC password depends on two things: 185 | * The type of communication channel (encrypted/unencrypted). 186 | * How secure access to the host is. 187 | 188 | When using a VNC password, it is highly desirable to enable the secure 189 | connection to prevent sending the password in clear over an unencrypted channel. 190 | 191 | **ATTENTION**: Password is limited to 8 characters. This limitation comes from 192 | the Remote Framebuffer Protocol [RFC](https://tools.ietf.org/html/rfc6143) (see 193 | section [7.2.2](https://tools.ietf.org/html/rfc6143#section-7.2.2)). Any 194 | characters beyhond the limit are ignored. 195 | 196 | ## Shell Access 197 | 198 | To get shell access to a the running container, execute the following command: 199 | 200 | ``` 201 | docker exec -ti CONTAINER sh 202 | ``` 203 | 204 | Where `CONTAINER` is the ID or the name of the container used during its 205 | creation (e.g. `crashplan-pro`). 206 | 207 | ## Reverse Proxy 208 | 209 | The following sections contains NGINX configuration that need to be added in 210 | order to reverse proxy to this container. 211 | 212 | A reverse proxy server can route HTTP requests based on the hostname or the URL 213 | path. 214 | 215 | ### Routing Based on Hostname 216 | 217 | In this scenario, each hostname is routed to a different application/container. 218 | 219 | For example, let's say the reverse proxy server is running on the same machine 220 | as this container. The server would proxy all HTTP requests sent to 221 | `tinymediamanager.domain.tld` to the container at `127.0.0.1:5800`. 222 | 223 | Here are the relevant configuration elements that would be added to the NGINX 224 | configuration: 225 | 226 | ``` 227 | map $http_upgrade $connection_upgrade { 228 | default upgrade; 229 | '' close; 230 | } 231 | 232 | upstream tinymediamanager { 233 | # If the reverse proxy server is not running on the same machine as the 234 | # Docker container, use the IP of the Docker host here. 235 | # Make sure to adjust the port according to how port 5800 of the 236 | # container has been mapped on the host. 237 | server 127.0.0.1:5800; 238 | } 239 | 240 | server { 241 | [...] 242 | 243 | server_name tinymediamanager.domain.tld; 244 | 245 | location / { 246 | proxy_pass http://tinymediamanager; 247 | } 248 | 249 | location /websockify { 250 | proxy_pass http://tinymediamanager; 251 | proxy_http_version 1.1; 252 | proxy_set_header Upgrade $http_upgrade; 253 | proxy_set_header Connection $connection_upgrade; 254 | proxy_read_timeout 86400; 255 | } 256 | } 257 | 258 | ``` 259 | 260 | ### Routing Based on URL Path 261 | 262 | In this scenario, the hostname is the same, but different URL paths are used to 263 | route to different applications/containers. 264 | 265 | For example, let's say the reverse proxy server is running on the same machine 266 | as this container. The server would proxy all HTTP requests for 267 | `server.domain.tld/tinymediamanager` to the container at `127.0.0.1:5800`. 268 | 269 | Here are the relevant configuration elements that would be added to the NGINX 270 | configuration: 271 | 272 | ``` 273 | map $http_upgrade $connection_upgrade { 274 | default upgrade; 275 | '' close; 276 | } 277 | 278 | upstream tinymediamanager { 279 | # If the reverse proxy server is not running on the same machine as the 280 | # Docker container, use the IP of the Docker host here. 281 | # Make sure to adjust the port according to how port 5800 of the 282 | # container has been mapped on the host. 283 | server 127.0.0.1:5800; 284 | } 285 | 286 | server { 287 | [...] 288 | 289 | location = /tinymediamanager {return 301 $scheme://$http_host/tinymediamanager/;} 290 | location /tinymediamanager/ { 291 | proxy_pass http://tinymediamanager/; 292 | location /tinymediamanager/websockify { 293 | proxy_pass http://tinymediamanager/websockify/; 294 | proxy_http_version 1.1; 295 | proxy_set_header Upgrade $http_upgrade; 296 | proxy_set_header Connection $connection_upgrade; 297 | proxy_read_timeout 86400; 298 | } 299 | } 300 | } 301 | 302 | ``` 303 | 304 | [TimeZone]: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones 305 | 306 | ## Support or Contact 307 | 308 | Having troubles with the container or have questions? Please 309 | [create a new issue]. 310 | 311 | ## Changelog 312 | 313 | See [Changelog from upstream](https://github.com/romancin/tinymediamanager-docker). 314 | -------------------------------------------------------------------------------- /docker-compose-example.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | tmm: 5 | image: dzhuang/tinymediamanager:latest-v4 6 | container_name: tinymediamanager-v4 7 | ports: 8 | - 5800:5800 9 | - 5900:5900 10 | volumes: 11 | - ./config:/config 12 | - ./media:/media 13 | environment: 14 | GROUP_ID: 1000 15 | USER_ID: 0 16 | TZ: Asia/Hong_Kong 17 | 18 | # Enable image/container auto update 19 | watchtower: 20 | image: containrrr/watchtower 21 | container_name: watchtower 22 | volumes: 23 | - /var/run/docker.sock:/var/run/docker.sock 24 | environment: 25 | TZ: Asia/Shanghai 26 | command: --interval 3600 tinymediamanager-v4 --cleanup 27 | --------------------------------------------------------------------------------