Go the next step and run a local kubernetes cluster with kind or k3s (it will take you 30 seconds to have a k8s cluster going). IMHO the kubectl CLI is a lot more logical than docker's CLI. You can create all your local storage volumes ahead of time, create a pod that attaches to it, and then just kubectl exec into the pod vs. writing a long fiddly docker command line string (or crafting a docker-compose.yml). It's easy to adjust the pod as necessary while it runs too, like adding a service to expose ports without rerunning the container.
But if you do like the idea of docker dev environemnts, check out a tool like batect: https://github.com/batect/batect It's somewhat like if docker-compose had make-like commands you could define. Your whole dev environment and workflow can be defined in a simple yaml config that anyone can use.
Won’t setting up a k8s cluster require writing resource definitions? I imagine you’d need to write a statefulset. How’s that better than writing a docker-compose?
I’m not sure how vscode does it, but it allows you to publish ports in real time as well.
Nope you can make a simple pod definition and not worry about a deployment. For a local cluster you'll just have one node and everything is effectively a statefulset. IMHO it's easier to write k8s yaml, there's tons of tooling, clear schemas, etc. You could even script calling the API server directly.
But if you do like the idea of docker dev environemnts, check out a tool like batect: https://github.com/batect/batect It's somewhat like if docker-compose had make-like commands you could define. Your whole dev environment and workflow can be defined in a simple yaml config that anyone can use.