Back
Question
How to create containers using API's??
Someone knows how to do it?
I have a service that is fully dockerized, where each tenant runs inside its own Docker container. I want to develop a RESTful API to manage these containers, allowing me to create new instances and retrieve information about specific ones. But i does not have any ideia about how to do it.
- • Create a New Docker Container:
- Endpoint: POST /service/instance
-
Functionality: This endpoint should create a new container instance;
- • Retrieve Information About a Specific Instance:
- Endpoint: GET /service/instance/{instanceID}/getInfo
-
Functionality: This endpoint should provide details about a specific instance, such as its status and metrics.
I am aiming to deploy these containers in some cloud platforms (AWS, Google Cloud, Vultr, DigitalOcean, ...)
Some advice how to do it?
Some advice how to do it?
👋 Join WIP to participate
what you really want is some service like ECS on AWS. And what you're asking is to create an container orchestrator all by itself.
if you look at k8 github.com/kubernetes/kuberne… it's got like 3600 contributors!
If your doing it to learn something then by all means try to code something by yourself, but for production you're gonna use a tool that exists.
Yeah, i was trying to avoid complexity that come with k8s - ECS could be a good solution and my question was to understand if someone has an simplified approach.
btw, thank you for answer.
Images are simple bu running them is a whole different level, I did a talk on it like 6 years ago ....
Totally agree, also a quote "running them in production/scale" sometimes could be a nightmare.
Thanks @Tom
sure np
Agree with what Tom said, don't try to implement this. It's a rabbit hole you probably don't want to go down.
If you want to deploy your containerized app to a VPS, take a look at something like Coolify or Kamal instead of doing it yourself
Or just try k3s on hetzner, thats what I would probably go with
Hey, pretty cool. Never heard of k3s but I like the idea of k8s without all the complexity - my last job had an entire team solely dedicated to managing and customizing k8s, it's truly a beast
I'll give k3s a look next time I need to do something like this
People make it way complicated than it has to be, but you do need to be familiar on how it works.
Actually it's first time that i see k3s, yeah looks great alternative. like @ben said, k8s demands a lot of efforts to keep up and it doesn't has teammates LoL
Additionaly, i saw some guys talking about Nomad from hashcorp, they presents himself as lighter alternative to k8s, i never used but sounds interesting;
Hmm, Coolify could be a life saver here, be able to deploy new services over API was my requirement, i'm little bit afraid about resiliency of this, and if it's safe to put in production but i probably will test and bring some comments,
Thank you @ben
Docker has a really good Python API that does the container interactions you want: docker-py.readthedocs.io/en/s…
If you prefer JS, they might have one too.
I would start with it and then wrap your own REST api around it via FastAPI or your framework of choice. I bet it's not a huge lift.
Hmmm, another interesting approach, if i decided to go ahed using dockers in some instance, that definelly could take care of API to that job.
Thank you
hey; not sure it is what you are looking for, but I manage my containers on my servers using coolify.io
I guess you can plug GCP/AWS to it
I started going down the k8s/orchestrators rabbit hole and felt it was too wide for me to spend enough time to get something working
Coolify lets me scale my small amount of containers nicely and gives me a UI where I can watch the status of my services
Also for frontend, it makes collab with my cofounder really nice as it makes per-branch preview deployments of our frontends
Everybody is talking about Coolify, start to feel more confortable with ideia to use this in production - it's such a great project and becoming popular
I was not sure about deploying anything in production using it, but honestly it feels quite stable for us rn
Also it's made by a maker just like us which make me love it even more :)
hmu if you need anything about it
I guess you can do similar stuff with GCP Cloud Run. It has CLIs, and SDKs that you can use to build upon. Not sure if you need container level isolation but this is a messy task, I am sure you considered serving tenants from single instance/deployment.
I build our own orchestrator for sliplane.io in Go using the moby sdk. I would not suggest that, instead use kubernetes, kamal, coolify or whatever and extend it if possible. Starting from scratch is rough :D