{"id":13819599,"url":"https://github.com/shawly/docker-nut","last_synced_at":"2025-05-16T04:34:15.705Z","repository":{"id":37608758,"uuid":"326276511","full_name":"shawly/docker-nut","owner":"shawly","description":"Docker container for https://github.com/blawar/NUT. \"latest\" \u0026 \"v3\" tags use stable release v3.3. \"edge\" tag uses latest master source code.","archived":false,"fork":false,"pushed_at":"2024-08-28T03:09:41.000Z","size":104,"stargazers_count":65,"open_issues_count":2,"forks_count":8,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-11-19T18:49:29.475Z","etag":null,"topics":["docker","docker-container","docker-image","hacktoberfest","nut"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shawly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-02T21:44:14.000Z","updated_at":"2024-10-05T13:57:53.000Z","dependencies_parsed_at":"2023-11-07T09:26:36.015Z","dependency_job_id":"1d248fec-3adb-48a9-94ac-97a334684cc3","html_url":"https://github.com/shawly/docker-nut","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawly%2Fdocker-nut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawly%2Fdocker-nut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawly%2Fdocker-nut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawly%2Fdocker-nut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shawly","download_url":"https://codeload.github.com/shawly/docker-nut/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254470303,"owners_count":22076566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-container","docker-image","hacktoberfest","nut"],"created_at":"2024-08-04T08:00:50.639Z","updated_at":"2025-05-16T04:34:11.103Z","avatar_url":"https://github.com/shawly.png","language":"Dockerfile","funding_links":[],"categories":["Dockerfile"],"sub_categories":[],"readme":"# Docker container for NUT\n\n[![Docker Automated build](https://img.shields.io/badge/docker%20build-automated-brightgreen)](https://github.com/shawly/docker-nut/actions) [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/shawly/docker-nut/Docker)](https://github.com/shawly/docker-nut/actions) [![Docker Pulls](https://img.shields.io/docker/pulls/shawly/nut)](https://hub.docker.com/r/shawly/nut) [![Docker Image Size (tag)](https://img.shields.io/docker/image-size/shawly/nut/latest)](https://hub.docker.com/r/shawly/nut) [![GitHub Release](https://img.shields.io/github/release/shawly/docker-nut.svg)](https://github.com/shawly/docker-nut/releases/latest)\n\nThis is a Docker container for NUT. An app that acts as a USB and network server for use with [Tinfoil](https://tinfoil.io/Download)\n\n---\n\n[![nut](https://dummyimage.com/400x110/ffffff/575757\u0026text=NUT)](https://github.com/blawar/nut)\n\nNUT by [blawar](https://github.com/blawar/nut).\n\n---\n\n## Table of Content\n\n- [Docker container for nut](#docker-container-for-nut)\n  - [Table of Content](#table-of-content)\n  - [Supported tags](#supported-tags)\n  - [Image Variants](#image-variants)\n  - [Supported Architectures](#supported-architectures)\n  - [Quick Start](#quick-start)\n  - [Usage](#usage)\n    - [Environment Variables](#environment-variables)\n    - [Data Volumes](#data-volumes)\n    - [Ports](#ports)\n    - [Changing Parameters of a Running Container](#changing-parameters-of-a-running-container)\n  - [Docker Compose File](#docker-compose-file)\n  - [Docker Image Update](#docker-image-update)\n  - [User/Group IDs](#usergroup-ids)\n  - [Using the NUT API](#using-the-nut-api)\n  - [Troubleshooting](#troubleshooting)\n\n## Supported tags\n\n\u003c!-- supported tags will be auto updated through workflows! --\u003e\n\n- `edge`, `edge-5e88b67`, `edge-5e88b6766daf1bd9cd04222323ad2638d736ed42` \u003c!-- edge tag --\u003e\n- `latest`, `v3`, `v3.4`, `v3.4.0` \u003c!-- latest tag --\u003e\n\n## Image Variants\n\nThis image comes in two different variants.\n\n### `shawly/nut:\u003cversion\u003e`\n\nThis image represents a stable or considered \"working\" build of NUT and should be preferred.\nIt will be built from a stable state of NUT, e.g. `tags/v3.3`.\n\n### `shawly/nut:edge-\u003ccommitsha\u003e`\n\nThis image represents a development state of this repo. It contains the latest features but is not considered stable, it can contain bugs and breaking changes.\nIf you are not sure what to choose, use the `latest` image or a version like `v3`.\nIt will be built from the latest `master` state of NUT.\n`edge` will always be the latest development image. If NUT is updated, the `edge` image will be rebuilt and tagged with the latest commit shortref e.g. `edge-9c726a5`.\n\n## Supported Architectures\n\nThe architectures supported by this image are:\n\n| Architecture | Status                                                   |\n| :----------: | -------------------------------------------------------- |\n|    x86-64    | working                                                  |\n|     x86      | untested                                                 |\n|    arm64     | [working](https://github.com/shawly/docker-nut/issues/3) |\n|    armv7     | untested                                                 |\n|    armhf     | untested                                                 |\n|   ppc64le    | dropped                                                  |\n\n_I'm declaring the arm images as **untested** because I only own an older first generation RaspberryPi Model B+ I can't properly test the image on other devices, technically it should work on all RaspberryPi models and similar SoCs. While emulating the architecture with qemu works and can be used for testing, I can't guarantee that there will be no issues, just try it._\n\n## Quick Start\n\n**NOTE**: The Docker command provided in this quick start is given as an example\nand parameters should be adjusted to your need.\n\nLaunch the nut docker container with the following command:\n\n```\ndocker run -d \\\n    --name=nut \\\n    -p 9000:9000 \\\n    -v $HOME/nut/titles:/nut/titles:rw \\\n    -v $HOME/nut/conf:/nut/conf:rw \\\n    -v $HOME/nut/_NSPOUT:/nut/_NSPOUT:rw \\\n    -v $HOME/nut/titledb:/nut/titledb:rw \\\n    shawly/nut\n```\n\nWhere:\n\n- `$HOME/nut/titles`: This location contains nsp files.\n- `$HOME/nut/conf`: This location contains the config files for NUT.\n- `$HOME/nut/_NSPOUT`: This location contains the nsp files packed by NUT.\n- `$HOME/nut/titledb`: This location contains the titledb.\n\n## Usage\n\n```\ndocker run [-d] \\\n    --name=nut \\\n    [-e \u003cVARIABLE_NAME\u003e=\u003cVALUE\u003e]... \\\n    [-v \u003cHOST_DIR\u003e:\u003cCONTAINER_DIR\u003e[:PERMISSIONS]]... \\\n    [-p \u003cHOST_PORT\u003e:\u003cCONTAINER_PORT\u003e]... \\\n    shawly/nut\n```\n\n| Parameter | Description                                                                                                                                              |\n| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| -d        | Run the container in background. If not set, the container runs in foreground.                                                                           |\n| -e        | Pass an environment variable to the container. See the [Environment Variables](#environment-variables) section for more details.                         |\n| -v        | Set a volume mapping (allows to share a folder/file between the host and the container). See the [Data Volumes](#data-volumes) section for more details. |\n| -p        | Set a network port mapping (exposes an internal container port to the host). See the [Ports](#ports) section for more details.                           |\n\n### Environment Variables\n\nTo customize some properties of the container, the following environment\nvariables can be passed via the `-e` parameter (one for each variable). Value\nof this parameter has the format `\u003cVARIABLE_NAME\u003e=\u003cVALUE\u003e`.\n\n| Variable            | Description                                                                                                                                                                                                                                                        | Default                             |\n| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------- |\n| `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`                              |\n| `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`                              |\n| `TZ`                | [TimeZone] of the container. Timezone can also be set by mapping `/etc/localtime` between the host and the container.                                                                                                                                              | `Etc/UTC`                           |\n| `UMASK`             | This sets the umask for the NUT process in the container.                                                                                                                                                                                                          | `022`                               |\n| `FIX_OWNERSHIP`     | This executes a script which checks if the USER_ID \u0026 GROUP_ID changed from the default of 1000 and fixes the ownership of the /nut folder if necessary, otherwise nut wont't start. It's recommended to leave this enabled if you changed the USER_ID or GROUP_ID. | `true`                              |\n| `TITLEDB_UPDATE`    | If the container should update the titledb when starting.                                                                                                                                                                                                          | `true`                              |\n| `TITLEDB_URL`       | Git repository from which the titledb should be pulled. (If you change this URL you need to remove the /nut/titledb folder within your container!)                                                                                                                 | `https://github.com/blawar/titledb` |\n| `TITLEDB_REGION`    | Region to be used when importing the titledb.                                                                                                                                                                                                                      | `true`                              |\n| `TITLEDB_LANGUAGE`  | Language to be used when importing the titledb.                                                                                                                                                                                                                    | `true`                              |\n| `NUT_API_SCHEDULES` | A json array with crontab schedules for calling api commands. The default value sets a cron schedule that runs a scan every 30 minutes. To disable scheduled api calls set this to `[]`. Check [Using the NUT API](#using-the-nut-api) down below for more info.   | `[{\"scan\": \"0/30 * * * *\"}]`        |\n\n### Data Volumes\n\nThe following table describes data volumes used by the container. The mappings\nare set via the `-v` parameter. Each mapping is specified with the following\nformat: `\u003cHOST_DIR\u003e:\u003cCONTAINER_DIR\u003e[:PERMISSIONS]`.\n\n| Container path | Permissions | Description                                             |\n| -------------- | ----------- | ------------------------------------------------------- |\n| `/nut/titles`  | rw          | This is the path NUT will use to scan for nsps.         |\n| `/nut/conf`    | rw          | This is the path NUT will use to read its config files. |\n| `/nut/_NSPOUT` | rw          | This is the path NUT uses for outputting nsp files.     |\n| `/nut/titledb` | rw          | This is the path NUT stores the titledb.                |\n\n**Note**: You can also use `/nut/titledb` within a separate bind mount or volume so your titledb is persisted between recreation of your container, this improves startup time.\n\n### Ports\n\nHere is the list of ports used by the container. They can be mapped to the host\nvia the `-p` parameter (one per port mapping). Each mapping is defined in the\nfollowing format: `\u003cHOST_PORT\u003e:\u003cCONTAINER_PORT\u003e`. The port number inside the\ncontainer cannot be changed, but you are free to use any port on the host side.\n\n| Port | Mapping to host | Description                     |\n| ---- | --------------- | ------------------------------- |\n| 9000 | Mandatory       | Port used for NUT webinterface. |\n\n### Changing Parameters of a Running Container\n\nAs seen, environment variables, volume mappings and port mappings are specified\nwhile creating the container.\n\nThe following steps describe the method used to add, remove or update\nparameter(s) of an existing container. The generic idea is to destroy and\nre-create the container:\n\n1. Stop the container (if it is running):\n\n```\ndocker stop nut\n```\n\n2. Remove the container:\n\n```\ndocker rm nut\n```\n\n3. Create/start the container using the `docker run` command, by adjusting\n   parameters as needed.\n\n## Docker Compose File\n\nHere is an example of a `docker-compose.yml` file that can be used with\n[Docker Compose](https://docs.docker.com/compose/overview/).\n\nMake sure to adjust according to your needs. Note that only mandatory network\nports are part of the example.\n\n```yaml\nversion: \"3\"\nservices:\n  nut:\n    image: shawly/nut\n    environment:\n      - TZ: Europe/Berlin\n      - USER_ID: 9000\n      - GROUP_ID: 9000\n      - TITLEDB_REGION: US\n      - TITLEDB_LANGUAGE: en\n      - NUT_API_SCHEDULES: \"[{\"scan\":\"0/30 * * * *}]\"\n    ports:\n      - \"9000:9000\"\n    volumes:\n      - \"$HOME/nut/titles:/nut/titles:rw\"\n      - \"$HOME/nut/conf:/nut/conf:rw\"\n      - \"$HOME/nut/_NSPOUT:/nut/_NSPOUT:rw\"\n      - \"$HOME/nut/titledb:/nut/titledb:rw\"\n```\n\n## Docker Image Update\n\nIf the system on which the container runs doesn't provide a way to easily update\nthe Docker image, the following steps can be followed:\n\n1. Fetch the latest image:\n\n```\ndocker pull shawly/nut\n```\n\n2. Stop the container:\n\n```\ndocker stop nut\n```\n\n3. Remove the container:\n\n```\ndocker rm nut\n```\n\n4. Start the container using the `docker run` command.\n\n## User/Group IDs\n\nWhen using data volumes (`-v` flags), permissions issues can occur between the\nhost and the container. For example, the user within the container may not\nexists on the host. This could prevent the host from properly accessing files\nand folders on the shared volume.\n\nTo avoid any problem, you can specify the user the application should run as.\n\nThis is done by passing the user ID and group ID to the container via the\n`USER_ID` and `GROUP_ID` environment variables.\n\nTo find the right IDs to use, issue the following command on the host, with the\nuser owning the data volume on the host:\n\n    id \u003cusername\u003e\n\nWhich gives an output like this one:\n\n```\nuid=1000(myuser) gid=1000(myuser) groups=1000(myuser),4(adm),24(cdrom),27(sudo),46(plugdev),113(lpadmin)\n```\n\nThe value of `uid` (user ID) and `gid` (group ID) are the ones that you should\nbe given the container.\n\n## Using the NUT API\n\nNUT provides an API for executing certain commands like scan and organize.\n\nReplace http://localhost:9000 with the actual address to your NUT instance.\n\n### Organize NSPs\n\nCall [`http://localhost:9000/api/organize`](http://localhost:9000/api/organize)\n\n### Scan for new NSPs\n\nCall [`http://localhost:9000/api/scan`](http://localhost:9000/api/scan)\n\n### Automated scans\n\nWith the latest `edge` image you can run automated schedules by configuring the `NUT_API_SCHEDULES` variable.\n\nThe default is set to `[{\"scan\": \"0/30 * * * *\"}]`, which calls `http://localhost:9000/api/scan` every full 30 minutes which will trigger a scan.\n\n#### Format\n\nThe format is set up like this:\n\n```json\n[\n  {\n    \"command\": \"min hour day month weekday\"\n  }\n]\n```\n\n#### Example\n\nIf you wanted for example to scan and organize your NSPs automatically every 15 minutes, your configuration would look like this:\n\n```json\n[\n  {\n    \"scan\": \"0/15 * * * *\"\n  },\n  {\n    \"organize\": \"0/20 * * * *\"\n  }\n]\n```\n\nSo your `NUT_API_SCHEDULES` value would look like this `[{\"scan\":\"0/15 * * * *\"},{\"organize\":\"0/20 * * * *\"}]`. This would now run the scan every 15 minutes and the organize command every 20 minutes.\n\nIf you use Docker Compose and define your environment variables in yaml format, make sure to use the compact format so that there is no space after the colons (`:`)!\n\n## Troubleshooting\n\n### The log says `could not load keys.txt, all crypto operations will fail`\n\nIf you just want to serve titles for your Switch you don't need the keys.txt at all.\nOtherwise you can extract the keys.txt via biskeydump and Lockpick or find them on the internet, I won't provide any links however, use Google.\n\n### The log says `titledb/db.nza unknown extension titledb/db.nza`\n\nYou can ignore this.\n\n### The log says something about \"Permission denied\" and/or NUT cant find any nsp files\n\nThis means your folder permissions are not correct or rather the folders are owned by a user that has a uid different from `1000`, see [User/Group IDs](#usergroup-ids).\nBeware, if you have the environment variable `FIX_OWNERSHIP` set to `true` and change the `USER_ID` or `GROUP_ID` your volume's ownership will be changed!\n\n### The log says `AttributeError: module 'collections' has no attribute 'Mapping'`\n\nThis is a bug that happens with NUT v3.3 when you use a `nut.conf` to store your settings, NUT seems to have an issue merging the `nut.default.conf` and your own `nut.conf`. The workaround for this is to remove the `nut.conf` file and make your changes in the `nut.default.conf`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshawly%2Fdocker-nut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshawly%2Fdocker-nut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshawly%2Fdocker-nut/lists"}