diff --git a/podman/README.md b/podman/README.md new file mode 100644 index 0000000..d4d0ff6 --- /dev/null +++ b/podman/README.md @@ -0,0 +1,75 @@ +# podman and container state + +Will install the following packages: +* podman + +It will set `linger` for the user running the podman containers (default user: root) and create user systemd units for that user, create systemd unit files as user and start them. + +Each container must have its own state file, named `.sls` and placed in the podman state folder. + +podman pillars: +``` +podman: + user: +``` + +container pillars: +``` +containers: + : + image: + tag: + volumes: + : + env: + : + ports: + - host: + - container: +``` + +## Example +``` +podman: + user: foo +containers: + mariadb: + image: docker.io/library/mariadb + tag: latest + volumes: + data: /var/lib/mysql + env: + MYSQL_ROOT_PASSWORD: verysecretpassword + ports: + - host: 3306 + container: 3306 + - host: 1234 + container 4321 + protocol: udp +``` + +### Steps done in above example: +* install podman +* set linger for user foo +* Create a firewald service for `mariadb` and add port `3306/tcp` and `1234/ucp` +* add `mariadb` firewalld service to `pillar.container.zone` (default is public) +* Create container controle script `/home/foo/bin/mariadb.sh` +* create podman volume named `mariadb-data` +* Create a podman container named `mariadb` +* Create systemd unit file for container `mariadb` named `mariadb.service` +* start mariadb service + +Each container will have a script wrapper for the service and container. +``` +Usage mariadb.sh [options..] +-h,-?, --help Show help and exit +-p, --pull pull container image (mariadb:latest) +-v, --volumes create container volumes +-c, --create create mariadb containers +-s, --start start and enables mariadb container +-S, --stop stop mariadb container +-i, --is-running check to see if container service is running +-u, --check-update check if there are image updates avaiable + --update perform image update if it exists +-g, --generate-systemd generate user systemd service unit file +```