omv6:omv6_plugins:docker_compose [omv-extras.org]

Summary概述

Docker is a technology that enables the creation and use of Linux containers. A container is a closed environment where one or more applications and their dependencies are installed, grouped and isolated from each other, running on the same operating system kernel.

Docker allows you to install, uninstall, modify, update applications as many times as you want without causing damage to the system.

The openmediavault-compose plugin provides a tool in the openmediavault GUI to create and manage containers using docker compose.

Two management methods are provided:

via yaml files.

via dockerfiles.

All generated files (yaml, env, dockerfiles, …) are stored in a user-defined folder.

Docker是一种支持创建和使用Linux容器的技术。容器是在同一操作系统内核上运行的一个封闭环境,其中一个或多个应用程序及其依赖项被安装、分组和隔离。 Docker允许您根据需要多次安装,卸载,修改,更新应用程序,而不会对系统造成损坏。 openmediavault-compose 插件在 openmediavault GUI 中提供了一个工具,用于使用 docker compose 创建和管理容器。 提供了两种管理方法:

通过 YAML 文件。 通过 dockerfiles。 所有生成的文件(yaml,env,dockerfiles等)都存储在用户定义的文件夹中。

Docker in OMV - Initial Setup初始设置

Docker in OMV is a document that provides a simple and secure docker management method. This guide establishes a method to successfully install a docker application on OMV. It is recommended to read it before installing docker or openmediavault-compose.

OMV 中的 Docker 是一个提供简单安全的 docker 管理方法的文档。本指南建立了在 OMV 上成功安装 docker 应用程序的方法。建议在安装 docker 或 openmediavault-compose 之前阅读它。

Prerequisites

OMV-Extras must be pre-installed.必须预先安装。

Installation

In OMV6's GUI: Under System > Plugins find and highlight openmediavault-compose 6.X, and click the Install button.

Before installing docker it is necessary to activate the docker repository. Go to System > omv-extras Click on the Docker repo button and click on the Save button.

在安装 docker 之前,有必要激活 docker 存储库。转到系统> omv-extras 单击Docker存储库按钮,然后单击“保存”按钮。

Settings

This is the plugin settings window.

In this window we can select the configuration file storage folder, we can define the docker installation place and we can install uninstall or restart docker.

这是插件设置窗口。

在此窗口中,我们可以选择配置文件存储文件夹,我们可以定义 docker 安装位置,我们可以安装卸载或重新启动 docker。

Under Services > Compose > Settings

在“服务”>“撰写>设置”下

Shared folder

The container configuration files are stored in this folder. The plugin will create subfolders for each container where it will store yaml files and env files respectively.

You can choose a shared folder if you have already created it or create it directly by pressing the “+” button on the right.

Since the openmediavault-sharerootfs plugin is a dependency of the openmediavault-compose plugin, you can create this folder in the root of the OMV system disk if you need to do so.

To define this folder do the following:

In the Shared Folder field select a shared folder. You can create it directly by clicking on “+”.

Click Save button.

共享文件夹

容器配置文件存储在此文件夹中。该插件将为每个容器创建子文件夹,分别在其中存储yaml文件和env文件。

您可以选择共享文件夹(如果您已经创建它),也可以通过按右侧的“+”按钮直接创建它。

由于 openmediavault-sharerootfs 插件是 openmediavault-compose 插件的依赖项,如果需要,您可以在 OMV 系统磁盘的根目录中创建此文件夹。

要定义此文件夹,请执行以下操作:

在“共享文件夹”项目中,选择一个共享文件夹。您可以通过单击“+”直接创建它。

单击保存按钮。

  Note It is a good idea to make backups of this folder. In case of reinstallation of OMV it is the only thing you need to redeploy your containers. This becomes more important if the defined folder is on the system drive for obvious reasons. 最好备份此文件夹。在重新安装 OMV 的情况下,您唯一需要重新部署容器的事情。 如果由于明显的原因,定义的文件夹位于系统驱动器上,则这一点变得更加重要。

Docker storage

At plugin installation time, docker will be installed simultaneously in the default path . This path will be on the OMV system disk./var/lib/docker

If you don't need to change anything, leave it as it is, docker is already installed.

If you need to change this route for any reason you can do the following:

In the Docker Storage field, type the path of the folder where you want to install Docker.

Click Save button.

Click Reinstall Docker button. Docker is now installed in the new path.

在插件安装时,docker 将同时安装在默认路径中。此路径将位于 OMV 系统磁盘上。

/var/lib/docker

如果您不需要更改任何内容,请保持原样,docker 已安装。

如果出于任何原因需要更改此路由,可以执行以下操作:

在“Docker 存储”字段中,键入要安装 

Docker 的文件夹的路径。

单击

保存按钮。

单击重新安装 

Docker 按钮。Docker 现在安装在新路径中。

  Notes This folder will store docker's internal working files, images, containers, etc. You do not need to back up this folder, it does not store any information that should be persistent. The default path is ''/var/lib/docker'' on the OMV system disk. If OMV is installed on a USB flash drive it is recommended to choose a different location to avoid excessive writing to this disk. Choosing a different disk will help prevent the system disk from filling up, which would cause OMV to malfunction. 此文件夹将存储 docker 的内部工作文件、映像、容器等。您不需要备份此文件夹,它不存储任何应该持久化的信息。 OMV 系统盘上的默认路径为 ''/var/lib/docker''。如果 OMV 安装在 USB 闪存驱动器上,建议选择其他位置以避免过度写入此磁盘。 选择不同的磁盘将有助于防止系统磁盘填满,从而导致OMV出现故障。

Files

Files is the yaml and env file management window, for configuring containers with docker-compose.

In this window you can perform any action necessary to manage these files, including creating, modifying, deleting, starting or stopping containers, updating images, etc.

The files generated here will be stored in subfolders within the folder configured in the plugin in the previous point.

The window displays a list of existing files and a top bar with buttons to perform various actions.

Selecting a file activates the buttons on the top bar.

Allows you to act on the container or containers defined in a yaml file simultaneously. Actions executed in this tab will be applied to all containers defined in the yaml file.  

Files 是 yaml 和 env 文件管理窗口,用于使用 docker-compose 配置容器。

在此窗口中,您可以执行管理这些文件所需的任何操作,包括创建、修改、删除、启动或停止容器、更新映像等。

这里生成的文件将存储在上一点插件中配置的文件夹内的子文件夹中。

该窗口显示现有文件的列表和一个顶部栏,其中包含用于执行各种操作的按钮。

选择一个文件将激活顶部栏上的按钮。

允许您同时对 yaml 文件中定义的一个或多个容器执行操作。在此选项卡中执行的操作将应用于 yaml 文件中定义的所有容器。

Under Services > Compose > Files

在“服务”下>撰写>文件

Create

Allows you to create the yaml and env configuration files of a container. Pressing the button will open a dialog window with the following fields:

Name

Name with which this file will be designated in the system.

Description

Description of the file to help identify it.

File

Here you can create (or copy and paste) the configuration yaml file for the container(s).

Environment

Here you can create (or copy and paste) the environment variable env file of the container(s).

Save

It will store the created yaml and env files in a subfolder of the compose folder, this subfolder will be given the name written in the name field.

You will exit the dialog window.

The created file will now appear on a line with the name on the left and the description on the right. Selecting this line will activate all the buttons to apply actions to this file.

Cancel

Exit without saving changes.

支持创建容器的 yaml 和 env 配置文件。按下按钮将打开一个对话框窗口,其中包含以下字段:

名字

在系统中指定此文件的名称。

描述

文件的说明,以帮助识别它。

文件

您可以在此处创建(或复制并粘贴)容器的配置 

yaml 文件。

环境

在这里,您可以创建(或复制和粘贴)容器的环境变量 

env 文件。

保存

它将创建的

yaml和

env文件存储在

compose文件夹的子文件夹中,该子文件夹将被赋予

名称字段中写的名称。

您将退出对话框窗口。

创建的文件现在将显示在一行上,左侧是名称,右侧是描述。选择此行将激活所有按钮以对此文件应用操作。

取消

退出而不保存更改。

https://hub.docker.com/r/linuxserver/resilio-sync    

Add from example从示例添加

Allows you to create example wrappers from preconfigured yaml files in the plugin.

Example

You can select a yaml file from the list.

Name

Name with which this file will be designated in the system.

Description

Description of the file to help identify it.

Save

Will set up the sample yaml and env files so that they can be edited and adapted to the server environment.

Cancel

Exit without saving changes.

允许您从插件中预配置的 yaml 文件创建示例包装器。

您可以从列表中选择 

yaml 文件。

名字

在系统中指定此文件的名称。

描述

文件的说明,以帮助识别它。

保存

将设置示例 

yaml 和 

env 文件,以便可以对其进行编辑并适应服务器环境。

取消

退出而不保存更改。

Autocompose

Allows you to create yaml configuration files from containers running on the system that have not been created with compose. Use only when necessary, the generated file will be much larger than necessary to deploy a container. Useful if you have lost the configuration data of a container created in the CLI.

Container

A list of working containers that can be imported into the compose plugin will appear.

Name

Name with which this container will be designated in the system.

Description

Description of the container functions to help identify it.

Version

The version of the docker yaml composition files that will be used to create the configuration file.

Create

It will generate the yaml and env files and store them in the compose folder inside the corresponding subfolder.

Cancel

Exit without saving changes.

自动撰写

允许您从系统上运行的容器创建 yaml 配置文件,这些容器尚未使用 compose 创建。仅在必要时使用,生成的文件将比部署容器所需的大得多。如果您丢失了在 CLI 中创建的容器的配置数据,则很有用。

容器

将出现可以导入到撰写插件中的工作容器列表。

名字

将在系统中指定此容器的名称。

描述

容器函数的描述,以帮助识别它。

版本

将用于创建配置文件的 docker yaml 组合文件的版本。

创造

它将生成yaml和env文件,并将它们存储在相应子文件夹内的撰写文件夹中。

取消

退出而不保存更改。

  Note In the Add from example button there is a file prepared to generate a Composerize container, which will generate yaml files from docker CLI container generation commands. 在“从示例添加”按钮中,有一个文件准备用于生成 Composerize 容器,该文件将从 docker CLI 容器生成命令生成 yaml 文件。

Import

Allows you to import existing compose compose files into the plugin.

In the dialog box enter the path to the folder containing the yaml files.

The import will succeed if you have your yaml files in a subfolder with the yaml file and subfolder having the same name:

compose_files

compose1

compose1.yml

compose1.env

compose2

compose2.yml

compose2.env

Click on Create button.

允许您将现有的撰写文件导入插件。

在对话框中,输入包含 yaml 文件的文件夹的路径。 如果您的 yaml 文件位于具有相同名称的 yaml 文件和子文件夹的子文件夹中,则导入将成功:

compose_files

作曲1

组合1.yml compose1.env 作曲2

组合2.yml compose2.env ... 单击创建按钮。

Edit

Allows you to edit the yaml and env files of the selected file.

The window is the same as the Create button already seen.

Activates when selecting a file.

编辑

允许您编辑所选文件的 yaml 和 env 文件。

该窗口与已看到的“创建”按钮相同。

选择文件时激活。

Delete

Allows you to delete a file.

The corresponding subfolder in compose folder along with the yaml and env configuration files will also be removed.

Activates when selecting a file.

删除

允许您删除文件。

撰写文件夹中的相应子文件夹以及yaml和env配置文件也将被删除。

选择文件时激活。

Check

It will check the configuration of a file and report possible errors if they are detected.

Util before launching the defined container or containers.

Any error that appears in a red box can be copied to the clipboard from the notifications button in the top bar of OMV to read it in its entirety.

Activates when selecting a file.

检查

它将检查文件的配置,并在检测到可能的错误时报告错误。

在启动定义的一个或多个容器之前使用。

出现在红色框中的任何错误都可以从OMV顶部栏中的通知按钮复制到剪贴板,以完整阅读。

选择文件时激活。

Up

Allows you to start the containers belonging to the selected yaml file.

If this is the first start, the container images will be downloaded, then the containers defined in the file will be put into operation.

Activates when selecting a file.

向上

允许您启动属于所选 yaml 文件的容器。

如果这是第一次启动,则将下载容器映像,然后将文件中定义的容器投入运行。

选择文件时激活。

Stop

Allows you to stop the containers defined in the selected file. Useful if some monitoring needs to find the container and see the output message.

Activates when selecting a file.

允许您停止所选文件中定义的容器。如果某些监视需要查找容器并查看输出消息,则非常有用。

选择文件时激活。

Down

Allows you to stop and remove the containers defined in the selected file.

Activates when selecting a file.

允许您停止和删除所选文件中定义的容器。

选择文件时激活。

Pull

Allows you to download the latest images available on the internet from the containers defined in the selected file.

Previous images are still on the system. To remove old images you can use the prune button.

Activates when selecting a file.

允许您从所选文件中定义的容器下载互联网上可用的最新映像。

以前的映像仍在系统上。要删除旧图像,您可以使用修剪按钮。

选择文件时激活。

ps

Allows you to see in a pop-up window the status of the containers defined in the selected file.

Activated when selecting a file.

附言

允许您在弹出窗口中查看所选文件中定义的容器的状态。

选择文件时激活。

Prune

Allows you to clean the system of images, containers, volumes or networks that are no longer needed and recover space.

System

Removes from the system any images, containers, volumes, or networks generated for containers that no longer exist in the openmediavault-compose GUI or are not used. It does the same as all the following buttons simultaneously.

Image

Removes downloaded container images from the system that no longer exist in the openmediavault-compose GUI or are not used.

Container

Removes from the system containers that no longer exist in the openmediavault-compose GUI or are not used.

Volume

Removes from the system volumes that no longer exist in the openmediavault-compose GUI or are not used.

Network

Removes container network interfaces from the system that no longer exist in the openmediavault-compose GUI or are not used.

修剪

允许您清理系统中不再需要的映像、容器、卷或网络并恢复空间。

系统

从系统中删除为容器生成的任何映像、容器、卷或网络,这些映像、容器、卷或网络不再存在于 openmediavault-compose GUI 中或未使用。它同时执行与以下所有按钮相同的操作。

图像

从系统中删除已下载的容器映像,这些映像不再存在于 openmediavault-compose GUI 中或未使用。

容器

从系统容器中删除 openmediavault-compose GUI 中不再存在或未使用的容器。

从系统卷中删除 openmediavault-compose GUI 中不再存在或未使用的卷。

网络

从系统中删除 openmediavault-compose GUI 中不再存在或未使用的容器网络接口。

Docs

Link to this guide.

Dockerfiles

This is the container creation dockefiles management window.

As in the files window, dockerfiles are managed in this window to perform any action on them. here the dockerfiles are created, modified, deleted, the created containers can be started, etc.

The generated dockerfiles will be stored in the folder configured in settings, using subfolders generated by the plugin.

The window shows a list of generated dockerfiles and a top bar of buttons that allow executing the actions required in each case.

Selecting a dockerfile activates the action buttons.

这是容器创建 dockefile 管理窗口。

与在文件窗口中一样,docker文件在此窗口中进行管理,以对其执行任何操作。在这里,Docker文件被创建,修改,删除,创建的容器可以启动,等等。

生成的 dockerfile 将使用插件生成的子文件夹存储在设置中配置的文件夹中。

该窗口显示生成的 dockerfile 列表和按钮顶部栏,这些按钮允许执行每种情况下所需的操作。

选择 dockerfile 将激活操作按钮。

Under Services > Compose > Dockerfiles

Create

Popup window to create a container using a dockerfile.

Name

Name with which this dockerfile will be designated in the system.

Description

Description of the dockerfile functions to help identify it.

Dockerfile

Here you can create (or copy and paste) the dockerfile for container creation.

Script filename

Name of the file with the script.

Script

Optionally here you can create (or copy and paste) a file with a script that will call dockerfile when run.

Conf filename

Name of the file with the environment parameters.

Conf file

Optionally here you can create (or copy and paste) a configuration file to be included within the image.

弹出窗口,用于使用 dockerfile 创建容器。

名字

在系统中指定此 dockerfile 的名称。 描述

dockerfile 函数的描述,以帮助识别它。 Dockerfile

在这里,您可以创建(或复制并粘贴)用于创建容器的 dockerfile。 脚本文件名

包含脚本的文件的名称。 脚本

(可选)在这里,您可以创建(或复制并粘贴)一个带有脚本的文件,该脚本将在运行时调用 dockerfile。 会议文件名

具有环境参数的文件的名称。 会议文件

(可选)您可以在此处创建(或复制并粘贴)要包含在映像中的配置文件。

Edit

Allows you to edit the dockerfile, script, and conf files of the selected container.

The window is the same as the Create button already seen.

Triggered by selecting a dockerfile.

允许您编辑所选容器的 dockerfile、脚本和 conf 文件。

该窗口与已看到的“创建”按钮相同。

通过选择 docker 文件触发。

Delete

Allows you to delete a container.

The corresponding subfolder in compose folder along with the dockerfile, script and conf configuration files will also be removed.

Triggered by selecting a dockerfile.

允许您删除容器。

compose 文件夹中的相应子文件夹以及 dockerfile、script 和 conf 配置文件也将被删除。

通过选择 docker 文件触发。

Build

It allows deploying the container following the dockerfile already configured.

Triggered by selecting a dockerfile.

它允许按照已配置的 dockerfile 部署容器。

通过选择 docker 文件触发。

Containers

Shows a list of running containers displaying the basic execution data.

Selecting a container activates the buttons on the top bar.

It allows acting on the containers individually. Actions executed in this tab will be applied only to the selected container, regardless of whether the yaml file defines one or more containers.

The Ports column will display a link that provides access to the GUI of each container via its port and the domain the server uses, opening a new tab in the web browser. Your router has to allow DNS registration of the other domain names and the client with the browser has to be able to look up that fqdn in dns. How that is done depends on the router/DHCP/DNS system you are using.

显示基本执行数据的正在运行的容器的列表。

选择容器将激活顶部栏上的按钮。

它允许单独作用于容器。在此选项卡中执行的操作将仅应用于所选容器,无论 yaml 文件是否定义了一个或多个容器。

“端口”列将显示一个链接,该链接通过每个容器的端口和服务器使用的域提供对每个容器的GUI的访问,并在Web浏览器中打开一个新选项卡。您的路由器必须允许其他域名的 DNS 注册,并且浏览器客户端必须能够在 DNS 中查找该 fqdn。如何完成取决于您使用的路由器/ DHCP / DNS系统。

Under Services > Compose > Containers

Pull

Allows you to download the latest image of the selected container available on the internet.

The behavior is the same as in Files pull but only the image of the selected container is downloaded, not all the containers that have been generated by the yaml file.

Activated by selecting a container.

Up

Allows you to display the selected container.

The behavior is the same as Files up but only the selected container will be started, not all the containers that have been generated by the yaml file.

Activates when selecting a container.

Restart

Allows you to restart the selected container.

Activated when selecting a container.

Logs

Allows you to view the log of the selected container.

Activated when selecting a container.

Stats

Shows a list of running containers displaying the usage status of the resources used.

Selecting a container activates the buttons on the top bar.  

Under Services > Compose > Stats

Inspect

Docker inspect provides detailed information about builds controlled by Docker.

Activated when selecting a container.

Logs

Allows you to view the log of the selected container.

Activated when selecting a container.

Dashboard

There are three widgets on the dashboard that provide docker container information:

Services Grid

Shows if docker is enabled and running by a green button.

Services Table

Shows in a list if docker is enabled and running.

Container Table

Shows a list with the name of each container that is running, the image used by that container, and the time it has been running. Stopped containers do not appear in this table.

Usual procedures

How to implement a container using a yaml file

If you have not already done so, define the folder where to store the configuration files. Go to Services > Compose > Settings In the dropdown choose a shared folder and click Save.

Go to Services > Compose > Files Click on Create.

Copy and paste your configuration yaml file into the File window.

Fill in the Name field with a name for the file.

Optionally type a description of the file in the Description field.

Optionally copy and paste your environment parameter file into the Environment window.

Press Save.

Press the Up button. The image(s) of the container(s) defined in the yaml file will be downloaded and those containers will be put into operation.

如何使用 yaml 文件实现容器

如果尚未这样做,请定义存储配置文件的文件夹。转到服务>撰写>设置 在下拉列表中选择一个共享文件夹,然后单击保存。

转到服务>撰写>文件,单击创建。

将配置 yaml 文件复制并粘贴到“文件”窗口中。

在“名称”字段中填写文件的名称。

(可选)在“描述”字段中键入文件的描述。

(可选)将环境参数文件复制并粘贴到“环境”窗口中。

按保存。

按向上按钮。将下载 yaml 文件中定义的容器的映像,并将这些容器投入运行。

How to update a single docker-compose container

Go to Services > Compose > Containers and select the container you want to update.

Press the Pull button. This will download the latest available image from that container.

Now go to Services > Compose > Files and select the file where that container is defined.

Click Up. The containers defined in the yaml file will start with the latest available image downloaded. Your container is already updated.

Press Prune and then press Image. Old images will be deleted.

如何更新单个 docker 撰写容器

转到“服务”> “撰写>容器”,然后选择要更新的容器。

按拉按钮。这将从该容器下载最新的可用映像。

现在转到“服务”> “撰写>文件”,然后选择定义该容器的文件。

单击向上。yaml 文件中定义的容器将从下载的最新可用映像开始。容器已更新。

按修剪,然后按图像。旧图像将被删除。

How to update multiple containers defined in a single docker-compose yaml file

Go to Services > Compose > Files and select the yaml file that defines the containers you want to update.

Press the Pull button. This will download the latest images available from all containers defined in the yaml file.

Click Up. The containers defined in the yaml file will be started with the latest available image downloaded from each container. Your containers are already up to date.

Press Prune and then press Image. Old images will be deleted.

如何更新单个 docker 组合 yaml 文件中定义的多个容器

转到“服务”>“撰写>文件”,然后选择定义要更新的容器的 yaml 文件。

按拉按钮。这将下载 yaml 文件中定义的所有容器中可用的最新映像。

单击向上。yaml 文件中定义的容器将使用从每个容器下载的最新可用映像启动。您的容器已经是最新的。

按修剪,然后按图像。旧图像将被删除。

How to delete containers from a yaml file

Go to Services > Compose > Files and select the yaml file that defines the containers you want to remove.

Click Down to stop the containers defined in that yaml file.

Press Prune and then press System. All data generated by those containers will be removed from the system.

If you want to delete the yaml file, click Delete. This will remove the yaml file.

如何从 yaml 文件中删除容器

转到“服务”>“撰写>文件”,然后选择定义要删除的容器的 yaml 文件。

单击“向下”以停止该 yaml 文件中定义的容器。

按修剪,然后按系统。这些容器生成的所有数据都将从系统中删除。

如果要删除 yaml 文件,请单击“删除”。这将删除 yaml 文件。

How to deploy a container using a dockerfile

If you have not already done so, define the folder where to store the configuration files. Go to Services > Compose > Settings In the dropdown choose a shared folder and click Save.

Create the dockerfile composition file: Go to Services > Compose > Dockerfiles Click on Create.

Copy and paste your configuration dockerfile into the dockerfile window.

Fill in the Name field with a name for the dockerfile.

Optionally type a description of the dockerfile in the Description field.

Optionally copy and paste your script file into the Script window so that the dockerfile can execute it. Write the name of this file in the Script filename field.

Optionally copy and paste your environment parameter file into the Conf file window so that it is included in the generated image. Write the name of this file in the Conf filename field.

Press Save.

Create the container and run it:

Select the dockerfile and press the Up button. The container will be created with the dockerfile commands and that container will be put into operation.

如何使用 dockerfile 部署容器

如果尚未这样做,请定义存储配置文件的文件夹。转到服务>撰写>设置 在下拉列表中选择一个共享文件夹,然后单击保存。

创建 dockerfile 组合文件:转到服务>撰写> Dockerfile 单击创建。

将您的配置 dockerfile 复制并粘贴到 dockerfile 窗口中。

在“名称”字段中填写 dockerfile 的名称。

(可选)在“描述”字段中键入 dockerfile 的描述。

(可选)将脚本文件复制并粘贴到“脚本”窗口中,以便 dockerfile 可以执行它。在“脚本文件名”字段中写入此文件的名称。

(可选)将环境参数文件复制并粘贴到 Conf 文件窗口中,以便将其包含在生成的映像中。在 Conf 文件名字段中写入此文件的名称。

按保存。

创建容器并运行它:

选择 docker文件,然后按向上按钮。将使用 dockerfile 命令创建容器,并且该容器将投入运行。

How to generate a composition yaml file with Autocompose

Go to Services > Compose > Files and press the Autocompose button

Expand the Container field. A list of all running containers will appear, select the container you want to generate a yaml file for.

In the Name field, type the name you want to use for the generated file.

In the Description field you can write a reminder summary of the file content.

In the Version field, select the version of docker-compose that will be used to generate the yaml file.

Press the Create button. The generated file will appear on a line in the Files tab list.

Select this file and press the Edit button to view the content of the generated file.

There will probably be more information than is needed to define the container, so you should clean this up or you will probably throw errors when you try to launch the container.

If you remember roughly what the original yaml file looked like, you can clean up the extra information.

You can search the internet for existing information about this container. If there is an example yaml file you can try to adapt yours to be as similar as possible.

Press the Save button.

Select the file again and press the check button.

The output can show you possible errors. If you detect any, go back to the previous step.

Select the file and press the Up button.

If the container is deployed without any problems the generated yaml file works. Otherwise you should keep checking for errors until it works.

如何使用自动撰写生成合成 yaml 文件

转到“服务”> “撰写>文件”,然后按“自动撰写”按钮

展开容器字段。将出现所有正在运行的容器的列表,选择要为其生成 yaml 文件的容器。

在“名称”字段中,键入要用于生成的文件的名称。

在“描述”字段中,您可以编写文件内容的提醒摘要。

在“版本”字段中,选择将用于生成 yaml 文件的 docker compose 版本。

按创建按钮。生成的文件将显示在“文件”选项卡列表中的一行上。

选择此文件,然后按“编辑”按钮以查看生成的文件的内容。

可能会有比定义容器所需的更多的信息,因此您应该清理它,否则在尝试启动容器时可能会引发错误。

如果您大致记得原始 yaml 文件的外观,则可以清理额外的信息。

您可以在互联网上搜索有关此容器的现有信息。如果有一个示例yaml文件,您可以尝试调整您的文件以使其尽可能相似。

按保存按钮。

再次选择文件,然后按检查按钮。

输出可以显示可能的错误。如果检测到任何内容,请返回到上一步。

选择文件,然后按向上按钮。

如果容器部署没有任何问题,则生成的 yaml 文件可以正常工作。否则,您应该继续检查错误,直到它起作用。

How to recover Portainer and other containers from versions prior to omv-extras 6.3 / openmediavault-compose 6.7

If you upgraded the plugin version to openmediavalt-compose 6.7 and had Portainer installed from omv-extras, at this point all your containers continue to work as usual and are reachable on their usual IP address and port, but you cannot access their functionality from the OMV GUI.

Portainer is just one more container, like the rest, therefore, the situation is the same.

To continue using Portainer, the procedure is to reinstall this container from the openmediavault-compose plugin, for this, you must first stop the Portainer container and remove it (This will not delete the existing configurations in the Portainer, only the container which can then be recreated keeping its current configuration). The way to do this requires running two simple commands on the CLI. Once this is done, the plugin allows you to retrieve the container to the existing path and working exactly as it did before.

If you did not have the plugin installed before the update, you must first install it and configure the Shared folder to store the yaml files.

The procedure to recover Portainer is as follows:

From the CLI run the following commands, you can access the CLI via the openmediavault-wetty plugin if you have it available or via SSH via putty or similar means:

sudo docker stop portainer

sudo docker rm portainer

In the OMV GUI go to Services > Compose > Files > Add from example

In the field example search and select portainer-omvextras

如何从 omv-extras 6.3 / openmediavault-compose 6.7 之前的版本恢复 Portainer 和其他容器

如果您将插件版本升级到 openmediavalt-compose 6.7 并从 omv-extras 安装了 Portainer,此时您的所有容器都可以继续照常工作,并且可以通过其通常的 IP 地址和端口访问,但您无法从 OMV GUI 访问它们的功能。

Portainer只是另一个容器,就像其他容器一样,因此,情况是一样的。

要继续使用 Portainer,该过程是从 openmediavault-compose 插件重新安装此容器,为此,您必须首先停止 Portainer 容器并将其删除(这不会删除 Portainer 中的现有配置,只会删除容器,然后可以重新创建容器,保持其当前配置)。执行此操作的方法需要在 CLI 上运行两个简单的命令。完成此操作后,该插件允许您将容器检索到现有路径并完全像以前一样工作。

如果在更新之前未安装插件,则必须首先安装它并配置共享文件夹以存储 yaml 文件。

恢复波泰纳的过程如下:

从 CLI 运行以下命令,您可以通过 openmediavault-wetty 插件(如果有)或通过 SSH 通过 putty 或类似方式访问 CLI:

sudo docker stop portainer

sudo docker rm portainer

在 OMV GUI 中,转到服务>撰写>文件>从示例添加

在字段示例中搜索并选择 portainer-omvextras

  Note There are two example Portainer yaml files: - The first one is called portainer, it is a standard file to do a fresh installation of Portainer at any time. You should not select this file in this case. - The second one is called portainer-omvextras, this yaml file has been included expressly for this plugin update, so it is already pre-configured so that Portainer continues to work in the same state before the update. This is the file you should select. 有两个示例Portainer yaml文件: - 第一个称为portainer,它是一个标准文件,可以随时进行Portainer的全新安装。在这种情况下,不应选择此文件。 - 第二个称为portainer-omvextras,此yaml文件已明确包含在此插件更新中,因此它已经预先配置,以便Portainer在更新之前继续以相同的状态工作。这是您应该选择的文件。

  Note This file extracts the Portainer Community Edition image, which is used by most people. If you upgraded to Business Edition replace the line image: portainer/portainer-ce:latest to image: portainer/portainer-ee:latest 此文件提取了大多数人使用的Portainer社区版图像。如果升级到商业版,请将行图像:portainer/portainer-ce:latest 替换为图像:portainer/portainer-ee:latest

In the Name field write portainer

In the Description field you can write portainer (optional field)

Press the Save button

Select the row of the portainer file (yellow color)

Press the Up button

If it gives an error, you may have to reinstall docker. In Services > Compose > Settings Click on the Reinstall Docker button and click Up button again.

Now your Portainer container is working exactly the same as you had it and you can manage your containers from Portainer just like before.

在“名称”字段中,写下 portainer 在“描述”字段中,您可以编写 portainer(可选字段) 按保存按钮 选择portainer文件的行(黄色) 按向上按钮

如果它给出错误,您可能需要重新安装 docker。在“服务>撰写>设置”中,单击“重新安装 Docker”按钮,然后再次单击“向上”按钮。 现在,您的Portainer容器的工作方式与您拥有的完全相同,您可以像以前一样从Portainer管理容器。

To recover any previously installed containers from the Portainer GUI and redeploy it to the plugin GUI the procedure is the same as for retrieving the Portainer container described above. With the exception that it will be necessary to have the configuration yaml file (stack).

If Portainer is running and accessible.

Copies the container stack (yaml file) to a text file. You will find it by clicking on the Stacks button in the Portainer GUI, then select the file and click on the Edit button.

Remove the stack. This will stop and remove the container.

In the OMV GUI go to Services > Compose > Files and click on Create

Copy the content of the yaml file in the File field and type the file name in the Name field

Press Save

Select the file line and press the Up button

Now the containers included in that file are working the same as before.

If Portainer is not accessible:

If you have a backup of the container configuration yaml file:

Follow the procedure described to recover the Portainer container, but instead of looking for a sample yaml file, create a new file with the backup copy of your yaml file.

If you do not have a backup of the container configuration yaml file:

In this case you can generate a yaml configuration file from a working container using Autocompose. You can do it from the GUI in Services > Compose > Files by pressing the Autocompose button

要从 Portainer GUI 恢复任何以前安装的容器并将其重新部署到插件 GUI,该过程与检索上述 Portainer 容器的过程相同。除了需要配置 yaml 文件(堆栈)之外。

如果 Portainer 正在运行且可访问。

将容器堆栈(yaml 文件)复制到文本文件。您可以通过单击Portainer GUI中的“堆栈”按钮找到它,然后选择文件并单击“编辑”按钮。

移除堆栈。这将停止并移除容器。

在 OMV GUI 中,转到“

服务>撰写>文件”,然后单击

“创建”

“文件”字段中复制 

yaml 文件的内容,然后在

“名称”字段中键入文件名

保存

选择文件行,然后按

向上按钮

现在,该文件中包含的容器的工作方式与以前相同。

如果无法访问Portainer:

如果您有容器配置 

yaml 文件的备份:

按照描述的过程恢复 Portainer 容器,但不是查找示例 yaml 文件,而是创建一个包含 

yaml 文件的备份副本的新文件。

如果没有容器配置 

yaml 文件的备份:

在这种情况下,您可以使用

自动撰写从工作容器生成 

yaml 配置文件。您可以通过按“

自动撰写”按钮从

“服务>撰写>文件的”GUI中执行此操作

  Note This is not an ideal situation, the generated file contains information that is not necessary and can prevent the container from running in some cases. You must locate the errors and correct them. 这不是理想的情况,生成的文件包含不必要的信息,并且在某些情况下可能会阻止容器运行。您必须找到错误并更正它们。

Once this file is generated, follow the procedure described to recover the Portainer container, but instead of looking for a sample yaml file, use the generated yaml file.

生成此文件后,请按照所述过程恢复 Portainer 容器,但不要查找示例 yaml 文件,而是使用生成的 yaml 文件。

To remove Portainer

If you have already redeployed all your containers in the plugin GUI you can remove Portainer, you no longer need it.

In Services > Compose > Files select the portainer file (yellow color).

Click on the Delete button.

CONGRATULATIONS, YOU'VE GOTTEN RID OF A HEAVY LOAD !! ;)

Why use openmediavault-compose, get rid of Portainer

删除搬运工

如果您已经在插件 GUI 中重新部署了所有容器,则可以删除 Portainer,您不再需要它。

在“

服务>撰写>文件”中,选择文件(黄色)。

单击

删除按钮。

恭喜,你已经摆脱了沉重的负担!;)

为什么要使用openmediavault-compose,摆脱Portainer

  Notes - Portainer is just a tool to manage other containers, it's just another container. The operation of Portainer is independent of the operation of other containers. - The openmediavault-compose plugin provides the necessary functionality to deploy and manage any container, including Portainer. - Containers deployed from the Portainer GUI using docker-compose will not be able to be managed from the openmediavault-compose GUI. - Containers deployed from the openmediavault-compose GUI will not be able to be managed from the Portainer GUI. - Given the functionality provided by the openmediavault-compose plugin, it is recommended to get rid of Portainer and manage all containers from the openmediavault-compose GUI. Managing from the plugin makes things much simpler and has added benefits. - Portainer只是一个管理其他容器的工具,它只是另一个容器。Portainer的操作独立于其他集装箱的操作。 - openmediavault-compose插件提供了部署和管理任何容器(包括Portainer)的必要功能。 - 使用 docker-compose 从 Portainer GUI 部署的容器将无法从 openmediavault-compose GUI 进行管理。 - 从 openmediavault-compose GUI 部署的容器将无法从 Portainer GUI 进行管理。 - 鉴于 openmediavault-compose 插件提供的功能,建议摆脱 Portainer 并从 openmediavault-compose GUI 管理所有容器。从插件进行管理使事情变得更加简单,并具有额外的好处。

How to Create a vlan with IP on the same LAN as the host

This is useful if you need a container to have an IP within your LAN that is different from your server's.

The most common use case for this procedure is installing pi-hole in docker on an OMV server. The reason in this case is that both pi-hole and OMV need the same port to function correctly, port 53. Therefore we need pi-hole to use a different IP on our network to be able to use that port without affecting OMV. There may be other use cases besides pi-hole, depending on the needs of the container you're setting up.

Note that containers using this network will expose all their ports on the LAN, just like any other IP, eg OMV. Docker provides an additional layer of security through port mapping (similar to a firewall). Through this procedure we lose that additional security layer. This does not have to be a problem, it is normal operation in any network, but it is convenient to be aware of this circumstance. Logically it will be useless to map ports in those containers, so you can save that part.

如何在与主机相同的局域网上创建具有 IP 的 VLAN

如果您需要容器在 LAN 中具有与服务器不同的 IP,这将非常有用。

此过程最常见的用例是在 OMV 服务器上的 docker 中安装 pi-hole。在这种情况下,原因是 pi-hole 和 OMV 都需要相同的端口才能正常工作,即端口 53。因此,我们需要 pi-hole 在我们的网络上使用不同的 IP,以便能够在不影响 OMV 的情况下使用该端口。除了 pi-hole 之外,可能还有其他用例,具体取决于您正在设置的容器的需求。

请注意,使用此网络的容器将在 LAN 上公开其所有端口,就像任何其他 IP(例如 OMV)一样。Docker 通过端口映射(类似于防火墙)提供额外的安全层。通过此过程,我们失去了额外的安全层。这不一定是问题,在任何网络中都是正常运行,但是了解这种情况很方便。从逻辑上讲,映射这些容器中的端口是没有用的,因此您可以保存该部分。

Creation and use of the vlan network interface with IP in our LAN

Interim procedure until the next plugin update is released.

We must create the network manually to be able to define the parameters we need and use it later in the containers. We'll call it mynet and create it using the following command (copy and paste into an SSH terminal):

在我们的局域网中创建和使用带有IP的VLAN网络接口

发布下一个插件更新之前的临时程序。

我们必须手动创建网络,以便能够定义我们需要的参数,并在以后的容器中使用它。我们将它称为mynet,并使用以下命令创建它(复制并粘贴到SSH终端中):

docker network create -d macvlan -o parent=eno1 \

--subnet 192.168.1.0/24 \

--gateway 192.168.1.1 \

--ip-range 192.168.1.240/29 \

--aux-address 'host=192.168.1.247' \

mynet

Adapt the network range to the network used by your LAN.192.168.1.0

Make sure that the gateway of your network is (IP of your router) or adapt it otherwise.192.168.1.1

Replace with the name of your network interface in OMV if it is different. You can see it in the GUI under Network > Interfaceseno1

You can change the network name if you want.mynet

使网络范围适应 LAN 使用的网络。

192.168.1.0

确保网络的网关是(路由器的IP)或以其他方式对其进行调整。

192.168.1.1

如果不同,请替换为 OMV 中网络接口的名称。您可以在 GUI 

中的网络>

接口下看到它

eno1

如果需要,可以更改网络名称。

mynet

This newly created interface, , will assign addresses in the established range , that is, from IP to IP . Therefore we can use this interface up to a maximum of 6 containers (you can expand it if you need more). So that this is not a problem with the IP assignment of your DHCP server (your router generally) you can reduce the assignment range, instead of allowing it to assign from 1 to 254, we can reduce it to from 1 to 235 for example. This is how we make sure to have those IPs free for docker. mynet192.168.1.240/29192.168.1.241192.168.1.246

Procedure to apply when the next plugin update is released.

We must create the network previously to be able to define the parameters we need and use it later in the containers. We will call it mynet and we will create it as follows:

In the OMV GUI go to Services > Compose > Networks Press the Add button.

Choose the name for your network and write it in the Name field. For example mynet.

In the Driver field, drop down the menu and choose macvlan.

In the Parent Network field, drop down the menu and choose your OMV network interface. You can check it in the GUI under Network > Interfaces.

In the Subnet field write the IP range of your local network. Usually it can be Adapt it to your network.192.168.1.0/24

In the Gateway field write the gateway of your network, normally your router, something like this Adapt it to your network.192.168.1.1

In the IP range field write Adapt it to your network.192.168.1.240/29

This network range is equivalent to the IP addresses between to This will allow us to assign IP addresses up to 6 containers, you can expand it if you need more. Any such website can help with this: IP calculator192.168.1.241192.168.1.246

So that this is not a problem with the IP assignment of your DHCP server (your router in general) you can reduce the assignment range, instead of letting it assign from 1 to 254, we can reduce it from 1 to 235 for example. This is how we make sure we have those free IPs for docker.

In the Aux address field you can optionally define an IP address to reserve for the host. In this case it would be host=192.168.1.247

This will be useful only if you need the host and the container to communicate with each other.

Press the Save button. At this moment the network is already created and you can use it in the configuration of any container.

You can inspect the network by selecting it and clicking the Inspect button to view its current values. When some container is using it, it should appear in this configuration.

这个新创建的接口 将分配已建立范围内的地址,即从 IP 到 IP 。因此,我们最多可以使用此接口 6 个容器(如果需要更多容器,可以扩展它)。为了使DHCP服务器(通常是路由器)的IP分配不是问题,您可以缩小分配范围,而不是允许它从1分配到254,例如,我们可以将其从1减少到235。这就是我们如何确保这些 IP 免费用于 docker。mynet192.168.1.240/29192.168.1.241192.168.1.246

发布下一个插件更新时要应用的过程。

我们必须先创建网络,以便能够定义我们需要的参数,并在以后的容器中使用它。我们称之为mynet,我们将按如下方式创建它:

在 OMV GUI 中,转到

服务>撰写

>网络,按

添加按钮。

选择网络的名称并将其写入“

名称”字段中。例如

mynet。

驱动程序字段中,下拉菜单并选择 

macvlan。

父网络字段中,下拉菜单并选择您的 OMV 网络接口。您可以在 GUI 中的

网络>

接口下进行检查。

“子网”字段中,输入本地网络的 IP 范围。通常它可以适应您的网络。

192.168.1.0/24

在“网关”字段中,写下网络的

网关,通常是路由器,如下所示 使其适应您的网络。

192.168.1.1

在“

IP 范围”字段中,写入“使其适应您的网络”。

192.168.1.240/29

此网络范围相当于 之间的 IP 地址 这将允许我们分配最多 6 个容器的 IP 地址,如果需要更多,您可以扩展它。任何这样的网站都可以对此提供帮助:

IP计算器

192.168.1.241

192.168.1.246

为了使DHCP服务器(通常是路由器)的IP分配不是问题,您可以缩小分配范围,而不是让它从1分配给254,例如,我们可以将其从1减少到235。这就是我们如何确保我们拥有 docker 的免费 IP。

“辅助地址”字段中,您可以选择定义要为主机保留的 IP 地址。在这种情况下,它将是

host=192.168.1.247

仅当需要主机和容器相互通信时,这才有用。

保存按钮。此时,网络已经创建,您可以在任何容器的配置中使用它。

您可以通过选择网络并单击“检查”按钮来

检查网络以查看其当前值。当某些容器使用它时,它应该出现在此配置中。

Assigning this network interface in a container

In order for a container to use the created network interface you need to add the following lines to the end of your compose file, assuming docker-compose is version 3 or higher. See the documentation for older versions of docker-compose.

在容器中分配此网络接口

为了使容器使用创建的网络接口,您需要将以下行添加到撰写文件的末尾,假设 docker-compose 是版本 3 或更高版本。请参阅旧版本的 docker-compose 的文档。

services:

pi-hole:

container_name: "pi-hole"

.

.

networks: mynet: ipv4_address: 192.168.1.241 networks: mynet: external: true

This sets up the mynet interface for that container and assigns it the IP value within our network, which was the first available. We will still be able to use up to in other containers. 192.168.1.241246

When we start the container we will be able to access its interface from the assigned IP and the usual port. If you don't need communication between the host and the containers, you're done.

这将为该容器设置 mynet 接口,并为其分配我们网络中的 IP 值,这是第一个可用的。我们仍然可以在其他容器中使用。192.168.1.241246

当我们启动容器时,我们将能够从分配的 IP 和常用端口访问其接口。如果不需要主机和容器之间的通信,则已完成。

If we need communication between the containers and the host

What has been applied so far is enough to use pihole and other applications, but sometimes it may be necessary for the container and the host to communicate with each other. Vlans have a limitation, by design they cannot communicate with the host. To overcome this setback and allow communication between the containers and the host, if necessary, we can create a network interface that will act as a bridge between the two.

如果我们需要容器和主机之间的通信

到目前为止已经应用的内容足以使用 pihole 和其他应用程序,但有时可能需要容器和主机相互通信。VLAN 有一个限制,根据设计,它们无法与主机通信。为了克服这一挫折并允许容器和主机之间的通信,如有必要,我们可以创建一个网络接口,作为两者之间的桥梁。

  Warning This procedure creates a binding interface for communication with the host via /etc/network/interfaces when OMV is using netplan. This can generate some conflict in certain circumstances. Do it at your own risk. If you have a suggestion to do this in a safe way you can post it in the forum. 此过程创建一个绑定接口,用于在 OMV 使用 netplan 时通过 /etc/network/interfaces 与主机进行通信。在某些情况下,这可能会产生一些冲突。风险自负。 如果您有以安全的方式执行此操作的建议,可以将其发布在论坛中。

Running the following commands would create this interface, but this configuration would not be persistent in OMV. On the first server restart it would disappear:

运行以下命令将创建此接口,但此配置不会在 OMV 中持久化。在第一次服务器重新启动时,它将消失:

ip link add mynet-host link eno1 type macvlan mode bridge

ip addr add 192.168.1.239/32 dev mynet-host

ip link set mynet-host up

ip route add 192.168.1.224/28 dev mynet-host

This would create a macvlan network interface called mynet-host in bridge mode that would use the IP . The host would use this network interface thanks to the static route set in the network range to communicate with the containers. 192.168.1.239192.168.1.224/28

To make this configuration persistent in OMV we must do it as follows:

Create a network interface configuration file:

这将在桥接模式下创建一个名为mynet-host的macvlan网络接口,该接口将使用IP。由于在网络范围内设置了静态路由,主机将使用此网络接口与容器通信。192.168.1.239192.168.1.224/28

要使此配置在OMV中持久存在,我们必须执行以下操作:

创建网络接口配置文件:

nano /etc/network/interfaces.d/99-mynet-host

Copy into that file the following content:

将以下内容复制到该文件中:

auto mynet-host

iface mynet-host inet static

pre-up ip link add mynet-host link eno1 type macvlan mode bridge

address 192.168.1.239/32

up ip link set mynet-host up

up ip route add 192.168.1.224/28 dev mynet-host

Replace with your network interface. You can see it in the GUI under Network > Interfaces.eno1

Save changes and exit the editor. and Ctrl+XYes

Restart the service or the server.

From now on those settings will be set every time the server is started.

替换为您的网络接口。您可以在 GUI 

中的

网络>接口下看到它。

eno1

保存更改并退出编辑器。 和

Ctrl+X

Yes

重新启动服务或服务器。

从现在开始,每次启动服务器时都会设置这些设置。

  Note If for some reason you need to create many different IPs keep in mind that macvlan uses different MAC addresses for each IP. This can be a problem if your hardware has a limit on the maximum number of MACs for the same physical interface. In that case you can change the configuration to ipvlan. Consult the official docker documentation in this regard to solve other possible configuration problems with ipvlan. 如果由于某种原因您需要创建许多不同的IP,请记住macvlan为每个IP使用不同的MAC地址。如果您的硬件对同一物理接口的最大 MAC 数量有限制,则这可能是一个问题。在这种情况下,您可以将配置更改为 ipvlan。在这方面,请查阅官方 docker 文档,以解决 ipvlan 的其他可能的配置问题。

Source Code

→ openmediavault-compose

文章链接

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: