LMK

Podman, cockpit

Podman = Docker

Podman, cockpit na przykładzie waifu2x, nunif

Instalacja w Debianie:

sudo apt install podman cockpit-podman

Zalecane:

sudo apt install gettext nodejs make
. /etc/os-release
echo "deb http://deb.debian.org/debian ${VERSION_CODENAME}-backports main" > \
    /etc/apt/sources.list.d/backports.list
apt update
apt install -t ${VERSION_CODENAME}-backports cockpit

Sprawdzamy:

sudo systemctl status cockpit
● cockpit.service - Cockpit Web Service
     Loaded: loaded (/lib/systemd/system/cockpit.service; static)
     Active: inactive (dead)
TriggeredBy: ● cockpit.socket
       Docs: man:cockpit-ws(8)

O usługa nie działa (dead), załączamy:

sudo systemctl enable --now cockpit

....😕

sudo systemctl enable --now cockpit
The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.
 
Possible reasons for having this kind of units are:
• A unit may be statically enabled by being symlinked from another unit's
  .wants/ or .requires/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
  a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
  D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
  instance name specified.

....😱

sudo systemctl status cockpit
● cockpit.service - Cockpit Web Service
     Loaded: loaded (/lib/systemd/system/cockpit.service; static)
     Active: inactive (dead) since Wed 2023-09-20 20:04:50 CEST; 1min 1s ago
TriggeredBy: ● cockpit.socket
       Docs: man:cockpit-ws(8)
    Process: 60886 ExecStartPre=/usr/lib/cockpit/cockpit-certificate-ensure --for-cockpit-tls (code=exited, status=0/SUCCESS)
    Process: 60899 ExecStart=/usr/lib/cockpit/cockpit-tls (code=exited, status=0/SUCCESS)
   Main PID: 60899 (code=exited, status=0/SUCCESS)
        CPU: 217ms

wrz 20 20:03:20 q4os-desktop systemd[1]: Starting Cockpit Web Service...
wrz 20 20:03:20 q4os-desktop cockpit-certificate-ensure[60893]: /usr/lib/cockpit/cockpit-certificate-helper: line 25: sscg: command not found
wrz 20 20:03:20 q4os-desktop cockpit-certificate-ensure[60894]: Generating a RSA private key
wrz 20 20:03:20 q4os-desktop cockpit-certificate-ensure[60894]: ..........................................................+++++
wrz 20 20:03:20 q4os-desktop cockpit-certificate-ensure[60894]: .......................+++++
wrz 20 20:03:20 q4os-desktop cockpit-certificate-ensure[60894]: writing new private key to '0-self-signed.key'
wrz 20 20:03:20 q4os-desktop cockpit-certificate-ensure[60894]: -----
wrz 20 20:03:20 q4os-desktop systemd[1]: Started Cockpit Web Service.
wrz 20 20:04:50 q4os-desktop systemd[1]: cockpit.service: Succeeded.

po chwili 😀

sudo systemctl start cockpit
lmk@q4os-desktop:~$ sudo systemctl status cockpit
● cockpit.service - Cockpit Web Service
     Loaded: loaded (/lib/systemd/system/cockpit.service; static)
     Active: active (running) since Wed 2023-09-20 20:11:50 CEST; 1min 2s ago
TriggeredBy: ● cockpit.socket
       Docs: man:cockpit-ws(8)
    Process: 61024 ExecStartPre=/usr/lib/cockpit/cockpit-certificate-ensure --for-cockpit-tls (code=exited, status=0/SUCCESS)
   Main PID: 61025 (cockpit-tls)
      Tasks: 8 (limit: 9419)
     Memory: 1.8M
        CPU: 1.517s
     CGroup: /system.slice/cockpit.service
             └─61025 /usr/lib/cockpit/cockpit-tls

Sprawdzamy, czy cockpit się odpalił na porcie http://localhost:9090:

Logowanie do http://localhost:9090

Działa 😀 😀 😀

Tworzenie obrazu:

podman build -t python -f podmanfile
STEP 1: FROM python:latest
Error: error creating build container: short-name "python:latest" did not resolve to an alias and no unqualified-search registries are defined in "/etc/containers/registries.conf"

-f oznacza plik, inaczej pokazuje, że nie znajduje katalogu,

-t nadaje nazwę (tag) obrazowi kontenera jako "python".

Musimy dopisać skąd, będziemy pobierać obrazy w pliku "/etc/containers/registries.conf":

Oficjalne źródło to Docker hub (innych narazie nie znam):

[registries.search]
registries = ['docker.io']

i restartujemy usługę:

sudo systemctl restart podman

Uruchomimy kontener w trybie interaktywnym i wcześniej budujemy image:

podman build -t nazwa_obrazu -f podmanfile && \
podman run -it nazwa_obrazu /bin/bash

Podmanfile kod na przykładzie nunif:

FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04
MAINTAINER nagadomi <[email protected]>

# install deps
RUN apt-get update -y && apt-get install -y git-core python3-pip libmagickwand-dev libraqm-dev

# install
RUN git clone https://github.com/nagadomi/nunif.git /root/nunif && \
    cd /root/nunif && \
    pip3 install torch torchvision torchaudio torchtext && \
    pip3 install -r requirements.txt && \
    python3 -m waifu2x.download_models && \
    python3 -m waifu2x.web.webgen.gen

WORKDIR /root/nunif

Uruchamianie nunif:

podman run -p 0.0.0.0:8812:8812 -it nunif001 /bin/bash
python3 -m waifu2x.web --port 8812 --bind-addr 0.0.0.0 --no-size-limit

Przenoszenie obrazu:

Eksport obrazu do archiwum tar
podman save -o obrazy.tar nazwa_obrazu
Przenieś plik obrazy.tar na inny komputer i zaimportuj obrazy
podman load -i obrazy.tar

Obrazy Podman są przechowywane w katalogu ~/.local/share/containers

Cofamy się w instrukcji i odpalamy na innym komputerze.

Czym jest waifu2x:

https://waifu2x.io

https://waifu2x.booru.pics

https://waifu2x.pro

https://play.google.com

Linki (pomoce) do podmana i cockpitu

https://cockpit-project.org

https://develmonk.com