Table of Contents


Link toDocker in OMV 7

(Docker) Compose Plugin For OMV7

(Docker) Compose Plugin For OMV7

(Docker) Compose Plugin For OMV7



Summary

Go to -> Docker compose


Docker in OMV - Initial Setup

Go to -> Docker in OMV 7
Docker in OMV 7 is a document that establishes a method to successfully install any application on OMV using Docker.

It is recommended to read it before installing Docker or openmediavault-compose. Go to → Docker in OMV 7


Prerequisites


Installation

Docker Repo In OMV7's GUI:
Under SYSTEM > OMV-EXTRAS Click on the DOCKER REPO button and click on the SAVE button. Now the docker repository is activated and you can install the compose plugin and docker.
Under SYSTEM > PLUGINS find and highlight openmediavault-compose 7.X, and click the INSTALL button.


  Warning
Do not uninstall the openmediavault-sharerootfs plugin. It is a dependency of the openmediavault-compose plugin. Uninstalling openmediavault-sharerootfs when the openmediavault-compose plugin is installed will cause the openmediavault-compose plugin to be uninstalled.


Settings

This is the plugin's general settings tab. We can define the necessary parameters for the operation of the plugin, as well as install, uninstall or restart docker.

Under Services > Compose > Settings

Settings


Compose Files


Data


Backup


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 drive.
Choosing a different disk will help prevent the system disk from filling up, which would cause OMV to malfunction.


Files

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

In this tab 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 Compose Files in the previous point.

The tab 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.

Under Services > Compose > Files

Files


Create

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


Add from example

Add from example Allows you to create example containers from preconfigured yaml files in the plugin. In this list you will find numerous examples of yaml files ready to be adapted to your system configuration and implemented next.


Add from URL

It allows you to download a file from a URL and create a configuration file from it.


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.

  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.


Import

Allows you to import existing compose files into the plugin.


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.


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.


Edit global environment file

Allows you to define global environment variables.

These variables will be available to be used in the compose file that we are interested in doing.

Example of variable in this file:

MYPUID=1000

Usage in a compose file:

- PUID=${MYPUID}

When that container is run docker will run this:

- PUID=1000


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.


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.


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.


Docs

Link to this document.


Services

This tab shows you the running services generated by docker containers.

Allows you to perform some actions on them.

The Ports column shows links that you can click to access the webui generated by each service.


Pull

It will download the latest image corresponding to the selected service.


Up

It will restart the selected service using the last downloaded image.


Restart

It will restart the selected service.


Logs

It will display the logs of the selected service up to this point and stop.


Follow Logs

It will display logs for the selected service and will continue to display new logs if any occur.



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

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.


Follow Logs

It will display logs for the selected container and will continue to display new logs if any occur.

Activated when selecting a container.


Images

Shows existing images on the system. Allows you to manage these images.


Delete

Deletes the selected image if it is not currently in use. If it is in use it will return an error and will not be removed.


Inspect

Displays the result of inspecting the selected image.


Networks

Shows existing networks on the system. Allows you to manage these networks.


Create

Opens a dialog that allows you to create a custom network interface.


Delete

Deletes the selected network interface.


Inspect

Inspects the selected network interface and lists its properties.


Volumes

Shows existing volumes on the system. Allows you to manage these volumes.


Delete

Deletes the selected volume.


Inspect

Inspects the selected volume and lists its properties.


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.

Under Services > Compose > Containers

Containers


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.


Follow logs

Shows the continuous output of the container logs.

Activated when selecting a container.


Dockerfiles

This is the Dockefiles management tab for creating images.

Dockerfiles are managed in this tab to perform any action on them. here the Dockerfiles are created, modified, deleted, etc.

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

The tab 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.

Under Services > Compose > Dockerfiles

Dockerfiles


Create

Create Dockerfile In this tab you can create a Dockerfile to generate your own container images.


Edit

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

The operation of this tab is similar to the Create button already seen.

Triggered by selecting a Dockerfile.


Delete

Allows you to delete a Dockerfile.

It will also remove the corresponding subfolder along with the Dockerfile configuration, script and conf files.

Triggered by selecting a Dockerfile.


Build

Allows you to deploy Dockerfile with the defined configuration. The first image will be pulled from the internet if it is not available on the host. A modified image will be created from the instructions defined in the Dockerfile.

Triggered by selecting a Dockerfile.


Pull and build

It will do the same as the Build button but the initial image will always be downloaded from the internet in its most updated version even if it exists on the host.

Triggered by selecting a Dockerfile.


Schedule (Updates and Backups)

Backup This tab manages the utility that allows you to perform plugin backups and/or container image updates. Displays a list of scheduled jobs.

By default, backups will be created of all the subfolders that contain the generated compose files. These subfolders are what the plugin generates every time we create a compose file in the GUI.

In addition, the volumes defined in each container that have a size of less than 1GB will be added to this backup. This size can be customized in the Settings tab.

You can customize any volume within a compose file to be included or excluded in the backup:

The backup performs the following process:

The update task performs the following process:

  Note
The advantage of the plugin's backup utility is that it stops the containers before doing the backup, which is actually a simple rsync. After that is when you should use whatever specialized backup utility you want, with deduplication, versioning, etc., to backup that folder copied with rsync. If you use any backup application directly with the containers running you can get an inconsistent backup.


Create

Schedule Opens a dialog box to schedule container backup and/or update jobs.


Edit

Opens the edit dialog for the selected task.


Delete

Deletes the selected task.


Run

Now executes the selected task. You will not receive an email if you run the scheduled job in this way.


Dashboard

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


Usual procedures


How to implement a container using a yaml file



How to update a single docker-compose container



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



How to delete containers from a yaml file



How to deploy a container using a dockerfile



How to generate a composition yaml file with Autocompose



How to Create a VLAN (Pi-hole, Adguard, ...)


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.


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

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:


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.

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 192.168.1.241 within our network, which was the first available. We will still be able to use up to 246 in other containers.

When we start the container we will be able to access its interface from the assigned IP and the usual port.


Reduce the IP range of the DHCP server (usually the router)

Once the above is done, in order to avoid overlapping assignable IP ranges, it would be advisable to reduce the IP range of the network's DHCP server. In the case of the previous configuration it could be set to:

This way addresses from 192.168.1.240 onwards will always be available, since the router will not assign any of these IPs if a device requests an IP assignment.

If you use the container itself as a DHCP server, for example with pi-hole, you must disable the DHCP server on your router and adapt the DHCP range in pi-hole accordingly.


If we need communication between the containers and the host

What has been applied so far is enough to use pihole, but in the case of other different containers 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.

  Warning
What follows from now on is a procedure that creates a binding interface for communication with the host via /etc/network/interfaces when OMV uses 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.

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:

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 192.168.1.239. The host would use this network interface thanks to the static route set in the 192.168.1.224/28 network range to communicate with the containers.

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

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

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

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

  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.


Source Code

openmediavault-compose


A Closing Note

We, who support the openmediavault project, hope you’ve found this guide to be useful and that you’ll find your openmediavault server to be efficient, easy to use, and enjoyable.

If you found this plugin guide to be helpful, please consider a modest donation to support the hosting costs of this server.

OMV-Extras.org



Venmo: ryecoaaron