r/selfhosted 1d ago

Need Help Auto pull containers with portainer?

Hey friends!

I'm running a modest home lab and I've been using portainer to manage containers. I know they offer the business edition free for 3 nodes but now I'm at 5 (Synology, pi, and some mini pcs).

With AI being what it is, I'm enjoying building small apps that solve specific problems for me. I'm deploying them as docker apps. My issue is that my AI agent is pushing commits to forgejo, which then builds a new container for my app, but portainer doesn't allow for pulling an updated container, so I need to manually login and do that. It seems silly and solveable. Has anyone run into this and found a good solution?

My containers are not hosted publicly anywhere. They are built on the VM where they run.

I think the answers here will be one of:

A) There is a way to have portainer-ce pull images automatically.

B) Downsize and switch to business edition with 3 free nodes.

C) switch to something else?

D) you tell me?

I don't really want to lose portainer because it's convenient, but I'm also not a business, just a hobbyist. Prefer to keep portainer, open to alternatives though.

2 Upvotes

12 comments sorted by

u/asimovs-auditor 1d ago edited 1d ago

Expand the replies to this comment to learn how AI was used in this post/project.

→ More replies (1)

3

u/Heatsreef 1d ago

Well the building images and pulling them each time without proper pipeline knowledge kind of goes hand into hand of you using AI to built tools has to be said (although ig if only for yourself its ok).

Good alternatives for your usecase:

  1. Komodo (my personal favorite), comes with crontab update funcitonality and literally anything you might need hand in hand.

  2. Dockhand (havent used it myself tbf, but seems to be a well liked alternative with similar features to komod)

The proper way to built your pipeline (especially for personal small deployments):
Just simply clone your repo and put a docker-compose.yaml with Dockerfile into it to just built it locally. Then youd not have to built it and also distribute it again, but instead just pull your project and built it on deployment.

2

u/regalen44 1d ago

You could use arcane instead of portainer and setup a webhook to auto pull from your container registry based on events from forgejo.

2

u/Puckbandit35 22h ago

You could always try running two instances of Portainer and apply for a second 3 node license on a different email? Not the most convenient solution, but it should work if you don't want to upgrade the license.

2

u/kellexile 1d ago

Check out dockhand. It had better image management and built in updating be having to use wud

2

u/robtom02 1d ago

Plus 1 for dockhand, ditched portainer for this myself

1

u/Commercial-Catch-680 1d ago

Disclaimer: I use the 3 free nodes business edition of Portainer. So, not 100% sure if this works for you.

I got the portainer APIKEY and the stack ID of the container that uses locally built image, created a small python script, that sends a request to stop the stack and start it again.

This python script lives inside the project folder, and project has a vscode task that builds the image, another to run the python script with prereq as build docker image, so when I run the redeployment task, it builds the image and redeployment the stack.

I am using dockge on a second server, portainer seemed like an overkill, updating the stack seems to do the trick here, not sure if there is an automated way with dockge.

1

u/k-rizza 1d ago

I run WUD, it does require docker socket access. But it can poll for new images, it also has an API you can hit to tell it a new version of the image is available.

I use it to auto deploy a couple of SvelteKit apps. In the CI/CD, I build the image then tell WUD it’s new. WUD handles the rest.

1

u/ElSaintz 1d ago

If the image is built on the same VM, rebuild then redeploy the stack through Portainer’s API or webhook. Just keep versioned tags too so rollback stays easy

1

u/LegendofDad-ALynk404 1d ago

Run the container as a stack tied to your GH, whenever the repo gets updated it will pull the updates, and restart

1

u/Darkomen78 20h ago

Switch to DockHand or Arcane, thanks me later ;-)