0
0
Fork 0
mirror of https://github.com/crazy-max/diun.git synced 2025-03-17 04:42:39 +00:00

Update docs for Podman support ()

Co-authored-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
Stig124 2021-04-28 23:11:43 +02:00 committed by GitHub
parent 244c2e3319
commit 810d451351
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 190 additions and 0 deletions

View file

@ -67,6 +67,9 @@ services:
restart: always
```
!!! note
If you are running [Podman](https://podman.io/), please check the appropriate [page](./podman.md)
Edit this example with your preferences and run the following commands to bring up Diun:
```shell

186
docs/install/podman.md Normal file
View file

@ -0,0 +1,186 @@
# Installation with Podman
## About
[Podman](https://podman.io) is now the default container runtime in some, *mainly RPM-based*, Linux distributions like RHEL.
Podman needs only a config tweak to work with diun as it is backwards-compatible with the Docker API.
## Prerequisites
!!! warning
Package `podman-docker` is not available in debian-based environment, only native method is supported
First of all you need to check if you have the `podman-docker` package installed with the following command:
```shell
rpm -q podman-docker
```
### Native podman method
!!! warning
Only install via `podman-compose`/`podman run` will work, due to file location change between podman and docker
!!! note
You need [Podman Compose](https://github.com/containers/podman-compose) to process `docker-compose` files
Enable and start the socket:
```shell
# monitoring root instance
sudo systemctl enable podman.socket
sudo systemctl start podman.socket
# monitoring user instance
systemctl enable --user podman.socket
systemctl start --user podman.socket
Without `podman-docker`, you need to modfiy the socket location
Replace this line in `docker-compose.yml` or in `podman run` *(keep the `-v`)* :
```yaml
- "/var/run/docker.sock:/var/run/docker.sock"
```
By *(without `-` on `podman run`)* :
```yaml
# When monitoring root instance :
- "/run/podman/podman.sock:/var/run/docker.sock"
# When monitoring rootless podman :
- "$XDG_RUNTIME_DIR/podman/podman.sock:/var/run/docker.sock"
# You need to modify $XDG_RUNTIME_DIR by the real value of the variable
# for the given user
```
`podman-compose` requires you to modify the container name to correctly start the pod
```diff
- container_name: diun
+ container_name: diun_app #or any name
```
Replacing the image name by the qualified name of the image is advised
```diff
- crazymax/diun:latest
+ docker.io/crazymax/diun:latest
```
#### Examples
##### Rootful (`root` user)
??? example "rootful docker-compose.yml"
```yaml
version: "3.5"
services:
diun:
image: docker.io/crazymax/diun:latest
container_name: diun_app
volumes:
- "./data:/data"
- "/run/podman/podman.sock:/var/run/docker.sock"
environment:
- "TZ=Europe/Paris"
- "LOG_LEVEL=info"
- "LOG_JSON=false"
- "DIUN_WATCH_WORKERS=20"
- "DIUN_WATCH_SCHEDULE=0 */6 * * *"
- "DIUN_PROVIDERS_DOCKER=true"
- "DIUN_PROVIDERS_DOCKER_WATCHSTOPPED=true"
labels:
- "diun.enable=true"
- "diun.watch_repo=true"
restart: always
```
??? example "rootful podman run"
```shell
podman run -d --name diun \
-e "TZ=Europe/Paris" \
-e "LOG_LEVEL=info" \
-e "LOG_JSON=false" \
-e "DIUN_WATCH_WORKERS=20" \
-e "DIUN_WATCH_SCHEDULE=0 */6 * * *" \
-e "DIUN_PROVIDERS_DOCKER=true" \
-e "DIUN_PROVIDERS_DOCKER_WATCHSTOPPED=true" \
-v "$(pwd)/data:/data" \
-v "/run/podman/podman.sock:/var/run/docker.sock" \
-l "diun.enable=true" \
-l "diun.watch_repo=true" \
docker.io/crazymax/diun:latest
```
##### Rootless
Grab the value of `$XDG_RUNTIME_DIR`
```shell
echo $XDG_RUNTIME_DIR
# Usually /run/user/1000, but can vary
```
With `/run/user/1000` as an example
??? example "rootless docker-compose.yml"
```yaml
version: "3.5"
services:
diun:
image: docker.io/crazymax/diun:latest
container_name: diun_app
volumes:
- "./data:/data"
- "/run/user/1000/podman/podman.sock:/var/run/docker.sock"
environment:
- "TZ=Europe/Paris"
- "LOG_LEVEL=info"
- "LOG_JSON=false"
- "DIUN_WATCH_WORKERS=20"
- "DIUN_WATCH_SCHEDULE=0 */6 * * *"
- "DIUN_PROVIDERS_DOCKER=true"
- "DIUN_PROVIDERS_DOCKER_WATCHSTOPPED=true"
labels:
- "diun.enable=true"
- "diun.watch_repo=true"
restart: always
```
??? example "rootless podman run"
```shell
podman run -d --name diun \
-e "TZ=Europe/Paris" \
-e "LOG_LEVEL=info" \
-e "LOG_JSON=false" \
-e "DIUN_WATCH_WORKERS=20" \
-e "DIUN_WATCH_SCHEDULE=0 */6 * * *" \
-e "DIUN_PROVIDERS_DOCKER=true" \
-e "DIUN_PROVIDERS_DOCKER_WATCHSTOPPED=true" \
-v "$(pwd)/data:/data" \
-v "/run/user/1000/podman/podman.sock:/var/run/docker.sock" \
-l "diun.enable=true" \
-l "diun.watch_repo=true" \
docker.io/crazymax/diun:latest
```
### Podman-docker method
!!! warning
If you have this package installed, you will only be able to monitor `root` podman instance.
You will **NOT** be able to monitor any user *rootless* instance.
Therefore this is not the recommanded method.
Enable and start the socket with :
```shell
sudo systemctl enable podman.socket
sudo systemctl start podman.socket
```
And you're good to go with default configuration and binary install if needed

View file

@ -88,6 +88,7 @@ nav:
- From Docker image: install/docker.md
- From binary: install/binary.md
- Linux service: install/linux-service.md
- Podman: install/podman.md
- Usage:
- Command line: usage/cli.md
- Basic example: usage/basic-example.md