{"id":38,"date":"2024-06-14T18:04:57","date_gmt":"2024-06-14T23:04:57","guid":{"rendered":"https:\/\/www.eeinc.us\/homelab\/?p=38"},"modified":"2024-10-16T13:31:11","modified_gmt":"2024-10-16T18:31:11","slug":"deploying-immich-with-rootless-podman","status":"publish","type":"post","link":"https:\/\/homelab.eeinc.us\/index.php\/2024\/06\/14\/deploying-immich-with-rootless-podman\/","title":{"rendered":"Deploying Immich with rootless podman"},"content":{"rendered":"\n<p class=\"has-drop-cap\"><a href=\"https:\/\/immich.app\/\">Immich<\/a> is a high-performance self-hosted photo and video management solution that allows you to share and synchronize photos and videos between multiple devices.  The <a href=\"https:\/\/immich.app\/docs\/overview\/introduction\">documentation<\/a> provides instructions on how to install Immich with Docker Compose, Kubernetes, Portainer, Unraid, TrueNAS Scale, and others.  But what if you, like me, want to install on Podman?  That&#8217;s the purpose of this post &#8212; to document how I deployed Immich on rootless Podman.  Many thanks to the authors of the countless posts I read that enabled me to be successful with my deployment.<\/p>\n\n\n\n<p>Perform the following steps to install Immich on rootless Podman:<\/p>\n\n\n\n<p><strong>Note:<\/strong> the initial commands assume you are running as the &#8216;root&#8217; user.  I know, I know, this is not recommended, that you should use &#8216;sudo&#8217;, etc., but since this is in my lab, I am willing to accept the risks while taking a shortcut.<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-44418d27ed7c9fe841c52f0a8fff0ad2\" style=\"color:#00aaff\">Create the non-root user<\/p>\n\n\n\n<p><code>useradd -c \"Immich Container Account\" -m immich<br>passwd immich  &lt;-- type the password for the immich account<br>loginctl enable-linger immich<\/code><\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-0397a3a94c0bb6d75c1607d126db0ec7\" style=\"color:#00aaff\">Create the directory structure for the container<\/p>\n\n\n\n<p><code>machinectl shell immich@<br>mkdir -p ~\/container\/immich\/database<br>mkdir -p ~\/container\/immich\/upload<br>mkdir -p ~\/container\/immich\/cache<\/code><\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-595a5976829adaf62954c9248a22f302\" style=\"color:#00aaff\">Create an environment file to store hostnames, IDs, and passwords used by the containers<\/p>\n\n\n\n<p><code>vim ~\/container\/immich\/environment.file<\/code><\/p>\n\n\n\n<p><code>DB_HOSTNAME=immich<br>DB_USERNAME=postgres<br>DB_PASSWORD=postgres<br>DB_DATABASE_NAME=immich<br>POSTGRES_USER=postgres<br>POSTGRES_PASSWORD=postgres<br>POSTGRES_DB=immich<br>REDIS_HOSTNAME=immich<\/code><\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-82d9cf6fe33e8c564ecc127207f2178b\" style=\"color:#00aaff\">Create the pod<\/p>\n\n\n\n<p><code>podman pod create --name immich --publish 192.168.194.55:2283:2283<\/code><\/p>\n\n\n\n<p><strong>Note:<\/strong> I had to hard-code the IP address for the published port to get the port forwarding to work. Otherwise, it would default to IPv6 addressing. Please let me know if you are successful getting it working without it.<\/p>\n\n\n\n<p><strong>Note:<\/strong> You can specify any external port instead of <code>2283<\/code>. If you change this port, change the firewall rules below.<\/p>\n\n\n\n<p><strong>Note:<\/strong> Beginning in v1.118.0 there is now port alignment with the internal port and the binding port.  Therefore, the published port changes to <code><strong>2283:2283<\/strong><\/code> from <code><strong>2282:3001<\/strong><\/code>.<\/p>\n\n\n\n<p><strong>Create the redis container<\/strong><\/p>\n\n\n\n<p><code>podman run \\<\/code><br>    <code>--replace\\<\/code><br>    <code>--detach \\<\/code><br>    <code>--pod=immich \\<\/code><br>    <code>--restart=always \\<\/code><br>    <code>--name=immich-redis \\<\/code><br>    <code>--label \"io.containers.autoupdate=image\" \\<\/code><br>    <code>docker.io\/redis:7.2.4<\/code><\/p>\n\n\n\n<p><strong>Create the database container<\/strong><\/p>\n\n\n\n<p><code>podman run \\<\/code><br>    <code>--replace \\<\/code><br>    <code>--detach \\<\/code><br>    <code>--pod=immich \\<\/code><br>    <code>--restart=always \\<\/code><br>    <code>--name=immich-database \\<\/code><br>    <code>--label \"io.containers.autoupdate=image\" \\<\/code><br>    <code>--env-file=\/home\/immich\/container\/immich\/environment.file \\<\/code><br>    <code>--volume ~\/container\/immich\/database:\/var\/lib\/postgresql\/data:Z<\/code> \\<br>    <code>docker.io\/tensorchord\/pgvecto-rs:pg14-v0.2.0<\/code><\/p>\n\n\n\n<p><strong>Create the server container<\/strong><\/p>\n\n\n\n<p><code>podman run \\<\/code><br>    <code>--replace \\<\/code><br>    <code>--detach \\<\/code><br>    <code>--pod=immich \\<\/code><br>    <code>--restart=always \\<\/code><br>    <code>--name=immich-server \\<\/code><br>    <code>--label \"io.containers.autoupdate=image\" \\<\/code><br>    <code>--env-file=\/home\/immich\/container\/immich\/environment.file \\<\/code><br>    <code>--volume ~\/container\/immich\/upload:\/usr\/src\/app\/upload:z \\<\/code><br>    <code>--volume \/etc\/localtime:\/etc\/localtime:ro \\<\/code><br>    <code>ghcr.io\/immich-app\/immich-server:release<\/code><\/p>\n\n\n\n<p><strong>Create the machine learning container<\/strong><\/p>\n\n\n\n<p><code>podman run \\<\/code><br>    <code>--replace \\<\/code><br>    <code>--detach \\<\/code><br>    <code>--pod=immich \\<\/code><br>    <code>--restart=always \\<\/code><br>    <code>--name=immich-machine-learning \\<\/code><br>    <code>--label \"io.containers.autoupdate=image\" \\<\/code><br>    <code>--env-file=\/home\/immich\/container\/immich\/environment.file \\<\/code><br>    <code>--volume ~\/container\/immich\/cache:\/cache:Z \\<\/code><br>    <code>ghcr.io\/immich-app\/immich-machine-learning:release<\/code><\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-2de3c9fcd21576370835d94e8e3a0c48\" style=\"color:#00aaff\">Daemonize and start the pod<\/p>\n\n\n\n<p><code>mkdir -p ~\/.config\/systemd\/user<br>cd ~\/.config\/systemd\/user<br>podman generate systemd --new --name --files immich<br>systemctl --user enable --now pod-immich.service<\/code><\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-6cd383de224ae649c79dfc0a9c6b2fe4\" style=\"color:#00aaff\">Enable the firewall rules<\/p>\n\n\n\n<p><code>firewall-cmd --permanent --zone=home --add-port=2283\/tcp<br>firewall-cmd --reload<\/code><\/p>\n\n\n\n<p><strong>Note:<\/strong> add the firewall rule to the appropriate zone. In my environment, I have a new zone named &#8216;home&#8217; that I use.<\/p>\n\n\n\n<p>When finished, <code>Press ^] three times within 1s to exit session.<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Immich is a high-performance self-hosted photo and video management solution that allows you to share and synchronize photos and videos between multiple devices. The documentation provides instructions on how to install Immich with Docker Compose, Kubernetes, Portainer, Unraid, TrueNAS Scale, and others. But what if you, like me, want to install on Podman? That&#8217;s the<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-38","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/homelab.eeinc.us\/index.php\/wp-json\/wp\/v2\/posts\/38","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/homelab.eeinc.us\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/homelab.eeinc.us\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/homelab.eeinc.us\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/homelab.eeinc.us\/index.php\/wp-json\/wp\/v2\/comments?post=38"}],"version-history":[{"count":12,"href":"https:\/\/homelab.eeinc.us\/index.php\/wp-json\/wp\/v2\/posts\/38\/revisions"}],"predecessor-version":[{"id":75,"href":"https:\/\/homelab.eeinc.us\/index.php\/wp-json\/wp\/v2\/posts\/38\/revisions\/75"}],"wp:attachment":[{"href":"https:\/\/homelab.eeinc.us\/index.php\/wp-json\/wp\/v2\/media?parent=38"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/homelab.eeinc.us\/index.php\/wp-json\/wp\/v2\/categories?post=38"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/homelab.eeinc.us\/index.php\/wp-json\/wp\/v2\/tags?post=38"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}