Skip to content

rootless podman support : working #6359

@kolonelkrazy

Description

@kolonelkrazy

Summary

The following is a hacky list of steps to get mailcow dockerized working on rootless podman. It is not intended to be run in production but was used to get a minimal viable setup working. There are many better ways to do some of the below steps but this was done quickly to prove it could be done.

Based on the below list of steps in appears to me some small non-invasive changes could be made to allow mailcow-dockerized to run on docker, podman, and rootless podman, i.e. very small changes to the current source code could be used to achieve this.

You do not have to disable ipv6 that was done for troubleshooting reasons of eliminating as much knee-banging clutter as possible. This issue is intended to remind to work on more surgical methods of introducing podman to mailcow-dockerized

  • set system-wide bash alias alias docker=podman
  • Remove docker checks in generate_config.sh
  • Add fully qualified registry to a couple of the missing service images
    • docker.io for ones without a registry
  • sysctl start ports - required by
    • for dev/debug just do echo net.ipv4.ip_unprivileged_port_start = 25 | sudo tee /etc/sysctl.d/90-unprivileged_port_start.conf
    • for production use iptables/nftables to forward to non-root port and change port bind on the services
  • docker socket
    • Replace all /var/run/docker.sock with ${XDG_RUNTIME_DIR}/podman/podman.sock
    • export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock
    • Make sure user podman socket is running
    • systemctl --user start podman.socket
    • If the socket is not running before it is mounted into the pod you won't be able to start the socket
    • Test the socket curl --unix-socket /run/user/1000/podman/podman.sock http://d/v1.24/info
      • loginctl enable-linger $USER
      • cat /usr/lib/systemd/user/podman.socket >
      [Unit]
      [Socket]
      ListenStream=%t/podman/podman.sock
      SocketMode=0660
      
      [Install]
      WantedBy=sockets.target
  • run ulimit -n under the user intended to run docker-compose, if it's above 65553 then do
    • remove ulimits section under dovecot-mailcow
    • if it's not above that number, manually change ulimits for the user for the time being
  • set HTTP_BIND and HTTPS_BIND ips in mailcow.conf
  • disable ipv6, see this page --> https://docs.mailcow.email/post_installation/firststeps-disable_ipv6/
  • edit php-pfm-mailcow entrypoint in data/Dockerfiles/docker-entrypoint.sh
    • remove ${COMPOSE_PROJECT_NAME}_mailcow-network from every curl command
    • replace line 35 to be the following
      curl --silent --insecure https://dockerapi/containers/json | jq -r ".[] | {name: .Config.Labels[\"com.docker.compose.service\"], project: .Config.Labels[\"com.docker.compose.project\"], id: .Id} | select(.name==\"mysql-mailcow\") | .id"
    • Modify docker-compose to build php-fpm-mailcow from docker file
    build:
        context: data/Dockerfiles/phpfpm
        dockerfile: Dockerfile
    image: localhost/mailcow/phpfpm-local

Motivation

Because I can

The latest improvements (SSO, LDAP, etc) allow me to finally transition some of my infrastructure off of toothpick and duct tape setups which closely resembled mailcow, but alas I am too tired to maintain. I'm a fan of rootless, and furthermore, podman setups, with aforementioned statement, here I am.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions