-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Support docker-compose #19
Comments
@NilsLattek thanks a lot for the issue! Currently its a difficult task to translate docker compose to Kubernetes yamls as there are many limitations and projects such as kompose don't really work with our use case. If you have any other idea how to implement this, please let us know. |
Thanks for the information @FabianKramm. I think you can judge this better than I do. |
I would propose a different approach to this problem: Make the devpod pod be a fully docker-capable container, with docker-compose. And then, INSIDE this pod, you can This would make devpod a little more like Codespaces, with the difference being that Codespaces provides a full blown VM as the parent "container" instead. For prototyping you can use I don't have any concerns with Here's a simple apiVersion: v1
kind: Pod
metadata:
name: devpod
spec:
containers:
- name: devpod
image: ghcr.io/felipecrs/devcontainer:2
imagePullPolicy: Always
securityContext:
privileged: true
volumeMounts:
- mountPath: /var/lib/docker
name: docker-data
terminationMessagePolicy: FallbackToLogsOnError
resources:
limits:
memory: "8G"
ephemeral-storage: "8Gi"
cpu: "4"
requests:
memory: "8G"
ephemeral-storage: "8Gi"
cpu: "4"
automountServiceAccountToken: false
enableServiceLinks: false
dnsPolicy: Default
volumes:
- name: docker-data
ephemeral:
volumeClaimTemplate:
spec:
storageClassName: local-path
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 24Gi $ k3d cluster create
$ kubectl apply -f devpod.yaml
$ kubectl wait --for=condition=ready pod/devpod
$ kubectl exec -it devpod -- docker version
$ kubectl exec -it devpod -- bash -exc 'pkgx install node npm; npm i -g @devcontainers/cli; devcontainer --version'
$ kubectl exec -it devpod -- git clone https://github.com/loft-sh/devpod
$ kubectl exec -it devpod -- devcontainer build --workspace-folder devpod
$ kubectl exec -it devpod -- devcontainer up --workspace-folder devpod
$ kubectl exec -it devpod -- devcontainer exec --workspace-folder devpod go version @FabianKramm what do you think? I'm eager for such thing as most of my .devcontainers are either based on docker compose or rely on mounting the docker socket like One thing that needs to be ensured is that the docker data-dir is contained within the workspace volume. |
When using devcontainers with Github codespaces it is possible to reference a docker-compose file in the
devcontainer.json
:Full example: https://github.com/devcontainers/templates/blob/main/src/dotnet-postgres/.devcontainer/docker-compose.yml
This will bring up one pod which runs the postgres database and a second one which you can use to develop the application. Both pods are linked so that the postgres db can be accessed from the dev container.
Right now this is not possible with the kubernetes provider:
[12:28:25] info devcontainer up: find docker compose: docker compose is not supported by this provider, please choose a different one
Is that something which is planned for the future?
The text was updated successfully, but these errors were encountered: