在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):linuxserver/docker-mods开源软件地址(OpenSource Url):https://github.com/linuxserver/docker-mods开源编程语言(OpenSource Language):Dockerfile 100.0%开源软件介绍(OpenSource Introduction):IntroThe purpose of the repository is to provide examples and guidance in creating and storing a user consumable modification layer for the Library of Linuxserver.io Containers. At it's core a Docker Mod is a tarball of files stored on Dockerhub and/or GitHub Container Registry that is downloaded and extracted on container boot before any init logic is run. This allows:
It is important to note to end users of this system that there are not only extreme security implications to consuming files from souces outside of our control, but by leveraging community Mods you essentially lose direct support from the core LinuxServer team. Our first and foremost troubleshooting step will be to remove the Again, when pulling in logic from external sources practice caution and trust the sources/community you get them from. LinuxServer.io Hosted ModsWe host and publish official Mods at the linuxserver/mods endpoint as separate tags. Each tag is in the format of Here's a list of the official Mods we host: https://mods.linuxserver.io/ Using a Docker ModBefore consuming a Docker Mod ensure that the source code for it is publicly posted along with it's build pipeline pushing to Dockerhub. Consumption of a Docker Mod is intended to be as user friendly as possible and can be achieved with the following environment variables being passed to the container:
Full example: docker create \
--name=nzbget \
-e DOCKER_MODS=taisun/nzbget-mod:latest \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Europe/London \
-p 6789:6789 \
-v <path to data>:/config \
-v <path/to/downloads>:/downloads \
--restart unless-stopped \
linuxserver/nzbget This will spinup an nzbget container and apply the custom logic found in the following repository: https://github.com/Taisun-Docker/Linuxserver-Mod-Demo This basic demo installs Pip and a couple dependencies for plugins some users leverage with nzbget. Creating and maintaining a Docker ModWe will always recommend to our users consuming Mods that they leverage ones from active community members or projects so transparency is key here. We understand that image layers can be pushed on the back end behind these pipelines, but every little bit helps. In this repository we will be going over two basic methods of making a Mod along with an example of the GitHub Actions build logic to get this into a Dockerhub and/or GitHub Container Registry endpoint. Though we are not officially endorsing GitHub Actions here it is built in to GitHub repositories and forks making it very easy to get started. If you prefer others feel free to use them as long as build jobs are transparent. One of the core ideas to remember when creating a Mod is that it can only contain a single image layer, the examples below will show you how to add files standardly and how to run complex logic to assemble the files in a build layer to copy them over into this single layer. Docker Mod Simple - just add scriptsIn this repository you will find the FROM scratch
# copy local files
COPY root/ / For most users this will suffice and anything in the root/ folder of the repository will be added to the end users Docker container / path. The most common paths to leverage for Linuxserver images will be:
The example files in this repo contain a script to install sshutil and a service file to run the installed utility. Docker Mod Complex - Sky is the limitIn this repository you will find the ## Buildstage ##
FROM ghcr.io/linuxserver/baseimage-alpine:3.12 as buildstage
RUN \
echo "**** install packages ****" && \
apk add --no-cache \
curl && \
echo "**** grab rclone ****" && \
mkdir -p /root-layer && \
curl -o \
/root-layer/rclone.deb -L \
"https://downloads.rclone.org/v1.47.0/rclone-v1.47.0-linux-amd64.deb"
# copy local files
COPY root/ /root-layer/
## Single layer deployed image ##
FROM scratch
# Add files from buildstage
COPY --from=buildstage /root-layer/ / Here we are leveraging a multi stage DockerFile to run custom logic and pull down an Rclone deb from the Internet to include in our image layer for distribution. Any amount of logic can be run in this build stage or even multiple build stages as long as the files in the end are combined into a single folder for the COPY command in the final output. Getting a Mod to DockerhubTo publish a Mod to DockerHub you will need the following accounts:
We recommend using this repository as a template for your first Mod, so in this section we assume the code is finished and we will only concentrate on plugging into GitHub Actions/Dockerhub. The only code change you need to make to the build logic file ENDPOINT: "user/endpoint"
BRANCH: "master" User is your Dockerhub user and endpoint is your own custom name (typically the name of the repository where your mod is). You do not need to create this endpoint beforehand, the build logic will push it and create it on first run. Head over to Add You can create a token by visiting https://hub.docker.com/settings/security GitHub Actions will trigger a build off of your repo when you commit. The image will be pushed to Dockerhub on success. This Dockerhub endpoint is the Mod variable you can use to customize your container now. Getting a Mod to GitHub Container RegistryTo publish a Mod to GitHub Container Registry you will need the following accounts:
We recommend using this repository as a template for your first Mod, so in this section we assume the code is finished and we will only concentrate on plugging into GitHub Actions/GitHub Container Registry. The only code change you need to make to the build logic file ENDPOINT: "user/endpoint"
BRANCH: "master" User is your GitHub user and endpoint is your own custom name (typically the name of the repository where your mod is). You do not need to create this endpoint beforehand, the build logic will push it and create it on first run. Head over to Add You can create a personal access token by visiting https://github.com/settings/tokens GitHub Actions will trigger a build off of your repo when you commit. The image will be pushed to GitHub Container Registry on success. This GitHub Container Registry endpoint is the Mod variable you can use to customize your container now. Submitting a PR for a Mod to be added to the official LinuxServer.io repo
AppendixInspecting modsTo inspect the file contents of external Mods dive is a great CLI tool: https://github.com/wagoodman/dive Basic usage: docker run --rm -it \
-v /var/run/docker.sock:/var/run/docker.sock \
wagoodman/dive:latest <Image Name> |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论