Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| docs_in_draft:docker_compose [2025/12/07 07:57] – [What is Docker] chente | docs_in_draft:docker_compose [2025/12/07 12:56] (current) – removed chente | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | < | ||
| - | < | ||
| - | {{ : | ||
| - | \\ | ||
| - | ---- | ||
| - | < | ||
| - | \\ | ||
| - | [[omv7: | ||
| - | |||
| - | ---- | ||
| - | \\ | ||
| - | \\ | ||
| - | ====== Docker in OMV 8 ====== | ||
| - | \\ | ||
| - | \\ | ||
| - | |||
| - | |||
| - | ===== Summary ===== | ||
| - | \\ | ||
| - | \\ | ||
| - | [[https:// | ||
| - | **This document establishes a method to successfully install any application on OMV using Docker.** | ||
| - | |||
| - | The [[https:// | ||
| - | |||
| - | In the case of Docker, the forum has received numerous queries about very diverse problems. Based on that forum experience, this document offers a simple method for configuring Docker that fixes the vast majority of these problems before they arise. | ||
| - | |||
| - | \\ | ||
| - | \\ | ||
| - | **Index:** | ||
| - | |||
| - | * [[omv7: | ||
| - | * [[omv7: | ||
| - | * [[omv7: | ||
| - | * [[omv7: | ||
| - | * [[omv7: | ||
| - | * [[omv7: | ||
| - | * [[omv7: | ||
| - | \\ | ||
| - | |||
| - | |||
| - | ---- | ||
| - | \\ | ||
| - | ===== What is Docker ===== | ||
| - | \\ | ||
| - | \\ | ||
| - | [[https:// | ||
| - | //" A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, | ||
| - | |||
| - | //Container images become containers at runtime and in the case of Docker containers – images become containers when they run on Docker Engine. Available for both Linux and Windows-based applications, | ||
| - | |||
| - | \\ | ||
| - | \\ | ||
| - | ** That's all very well, but... :-) What the hell is docker? :-) ** | ||
| - | \\ | ||
| - | \\ | ||
| - | \\ | ||
| - | [[omv7: | ||
| - | That definition is very good and very professional, | ||
| - | |||
| - | Docker is a system that allows you to run an application within your server as if it were an independent and isolated system. It has its own processes, its own file system, and its own networking, all independent of the main (host) server. The container cannot access the host's file systems or network, and vice versa. This is why we say that it is isolated, and way it cannot damage your system. It is safe. | ||
| - | |||
| - | Docker is quite similar to a virtual machine, but with one key difference: a virtual machine includes a complete operating system, with its own kernel, drivers, and services. Docker, on the other hand, does **not** run a complete operating system. Instead, it uses the host's kernel and only isolates the container' | ||
| - | |||
| - | Because of this, containers consume far fewer resources and start up in a matter of seconds, although their isolation is not as deep as that of a traditional virtual machine. | ||
| - | |||
| - | **This makes containers designed for different architectures**. A container designed for Raspberry PI (ARM architecture) will not work on an Intel/AMD system (amd64 architecture) and vice versa. You should keep this in mind when choosing a container to install on your system. | ||
| - | |||
| - | Many modern containers include multiple architectures, | ||
| - | |||
| - | At this point it is good to remember that the **32-bit architecture is obsolete**, little by little 32-bit containers are disappearing. OMV 8 no longer works on 32-bit systems, so **if you were able to install OMV 8, your system is 64-bit**. This simplifies things considerably: | ||
| - | [[omv7: | ||
| - | |||
| - | The operation of docker is very simple. Someone on the Internet packages a system into a file we call an **image**. This image contains the necessary packages for the application we want to use to work. Docker downloads that image, installs it on our server and runs it. We already have a **container** working. | ||
| - | |||
| - | Now the creator of that image does the corresponding maintenance and publishes a new updated image. Docker can download and apply the new image if you trigger an update. Tools like docker-compose make this easy by pulling the updated image and restarting the container. This way, your container can be kept up to date. | ||
| - | |||
| - | So far so good. But now we want to configure certain information in our application, | ||
| - | |||
| - | Mapping a folder means that Docker will make a configuration such that when the container writes to the ''/ | ||
| - | |||
| - | In the same way that Docker maps folders it can also **map network ports**, we can map port 3800 that the container uses internally to any port on our server, for example 4100, the container will send data packets to port 3800 internally but Docker will that these packets be sent through port 4100 of our server. | ||
| - | [[omv7: | ||
| - | **We can also map users**. And this is important to understand. The container will work internally as //root//, but we can make that user be another user on the server, for example the user // | ||
| - | |||
| - | To define all these container configurations the **openmediavault-compose plugin uses docker-compose** for its simplicity. Using a configuration file of a few lines we define the mappings and other configurations of a container and then we execute it. | ||
| - | |||
| - | To map a user we define the PUID value, the user's identifier, and to map the group it will be the PGID value, the group' | ||
| - | |||
| - | '' | ||
| - | |||
| - | '' | ||
| - | |||
| - | The way to map a folder (**volume**) in docker-compose is something like this: | ||
| - | |||
| - | '' | ||
| - | |||
| - | That could be one of the lines in the compose file that defines a container. This line is divided into two parts. To the left of the '':'' | ||
| - | |||
| - | < | ||
| - | | ||
| - | </ | ||
| - | All that long string of numbers is the path of one of our disks on the server and inside that disk we have an appdata folder and inside we create the folderpass folder< | ||
| - | Filesystem mount paths are usually in the /srv folder and the following folder contains a uuid to uniquely identify that drive. That folder is the mount folder for that hard drive. You should never modify the permissions of that folder or use it to create a shared folder. Create a folder inside to use as a shared folder. | ||
| - | </ | ||
| - | |||
| - | From now on, every time the //root// user of the container writes to its ''/ | ||
| - | |||
| - | The advantage of all this is that the container is limited to writing to that folder. We could be unlucky enough to download an image that has harmful code inside. Or if that container was exposed to the internet and had a security hole, perhaps it could be hacked. In this case the hacker could take control of the //root// user of the container. The advantage is that that //root// user on our system is actually the // | ||
| - | |||
| - | Conclusion. **Never map the container user to the //root// user of the server**, unless it is absolutely necessary and the container developer is fully trusted. If there were a security hole in that container, your server would be at the mercy of the hacker, since they would have permissions for everything. Related to this, **never include the user running a container in the //docker// group**, this is another story but any user in the docker group can gain //root// access to the system by escalating permissions. | ||
| - | |||
| - | If you're reading this, it's probably your first time using Docker. Docker may seem complicated at first glance, but once you get over the initial learning curve, setting up and installing a container literally takes less than 30 seconds. Keep going. | ||
| - | |||
| - | ---- | ||