Start / Stop dockers by port? reddit / selfhosted ---------------------------------------------------------------------- Other_Engineering454 · 2023-12-09 07:41 I have a number of services on my server that most of the time are not being used (CyberChef and Serge for example). I am looking for a way to have those docker containers stopped until the port is accessed, then when the port is accessed the docker would start and the page redirect when the webui is available. I was thinking of using flask with python since I'm pretty comfortable with python, but I wanted to check if something like this already exists before recreating something that's already out there. ---------------------------------------------------------------------- DryPhilosopher8168 · 2023-12-09 08:14 I am not aware of anything that does this automatically. You could use KASM. There your will have a dashboard which will start docker/vm/LXC instances when clicked and shut them down if you logout if I am not mistaken. I will watch this. Maybe there are better solutions. ---------------------------------------------------------------------- Sp33dFr34k85 · 2023-12-09 08:16 I don't know of such a solution, but it sounds like something I'd love to use as well. Following :) ---------------------------------------------------------------------- ElevenNotes · 2023-12-09 08:30 Traefik with the container plugin. ---------------------------------------------------------------------- ElevenNotes · 2023-12-09 08:30 Traefik can do this. ---------------------------------------------------------------------- DryPhilosopher8168 · 2023-12-09 08:33 I thought so but I haven't found any documentation after a short Google search. Do you have a link? ---------------------------------------------------------------------- ElevenNotes · 2023-12-09 08:38 There are several [plugins](https://plugins.traefik.io/plugins) that do stuff like this. ---------------------------------------------------------------------- DryPhilosopher8168 · 2023-12-09 08:40 Nice! One possible plug in you could use: https://acouvreur.github.io/sablier/ ---------------------------------------------------------------------- DryPhilosopher8168 · 2023-12-09 08:41 Awesome added on example link to your awnser. Thank you very much for the hint. ---------------------------------------------------------------------- thekrautboy · 2023-12-09 09:04 Sablier is a tool that can do this. It also exists as a plugin for the Traefik reverse proxy. Lazytainer can also do this. ---------------------------------------------------------------------- ElevenNotes · 2023-12-09 09:11 You're welcome. ---------------------------------------------------------------------- adamshand · 2023-12-09 09:52 Sablier looks great, thanks! ---------------------------------------------------------------------- notdoreen · 2023-12-09 15:20 Can you explain the use case for this and the reason for wanting this? ---------------------------------------------------------------------- Other_Engineering454 · 2023-12-09 15:56 Cheap hardware without a lot of resources. Keeping them off when not in use means not as many are on at once and I can have more available services. ---------------------------------------------------------------------- Other_Engineering454 · 2023-12-09 16:02 Sweet. Thanks both of you for the replies. I'd already been debating switching from npm to Traefik. Looks like it's time to take that plunge. ---------------------------------------------------------------------- Other_Engineering454 · 2023-12-09 16:08 Thanks for the reply. It looks like Traefik and Sablier is the way to go. I did make a mental note to look at LazyTrainer as well. ---------------------------------------------------------------------- Other_Engineering454 · 2023-12-09 16:09 This is realistically where I saw my Python + Flask script going, but it's nice to know something already exists. ---------------------------------------------------------------------- GenerousAccord · 2023-12-09 16:57 On Linux, I believe this may do what you want: https://blog.developer.atlassian.com/docker-systemd-socket-activation/ ---------------------------------------------------------------------- emprahsFury · 2023-12-09 17:26 Any of the good old super-servers. (x)inetd, systemd. It's an old question with several answers. Netcat w/ -e probably could do this. ---------------------------------------------------------------------- root-node · 2023-12-09 21:43 How many services are you running? I have 12 containers on a single 4th gen Intel NUC with 16gb RAM. The CPU and RAM usage is always very low. https://i.imgur.com/XLQaeyF.png ---------------------------------------------------------------------- Other_Engineering454 · 2023-12-10 00:30 Old hp desktop with 4gb of ram. It's just a hobby for learning so I'm not trying to invest must. ---------------------------------------------------------------------- Kooky_Percentage3687 · 2023-12-10 01:41 The only downside is services have to be managed by files, you cannot use labels, which I believe is the non preferred method ---------------------------------------------------------------------- NinjaFragrant7710 · 2023-12-10 10:02 Thats actually a really awesome idea. Does anyone know if this can be implemented using NPM instead of Traefic? ---------------------------------------------------------------------- krystianduma · 2023-12-10 12:50 Maybe, but why would you want to reinvent the wheel?