Skip to content
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

Docker volumes in docker compose not working #10

Closed
dct0 opened this issue Jun 20, 2024 · 6 comments
Closed

Docker volumes in docker compose not working #10

dct0 opened this issue Jun 20, 2024 · 6 comments

Comments

@dct0
Copy link
Contributor

dct0 commented Jun 20, 2024

Basic Information

I want to be able to specify docker volumes in a docker compose and run docker compose up in a dev container to start everything up. The bind mounts don't seem to work in this case, and it's likely something to do with the docker-in-docker situation.

Other Information

https://github.com/h4l/dev-container-docker-compose-volume-or-bind

@dct0
Copy link
Contributor Author

dct0 commented Jun 20, 2024

Or maybe the LOCAL_WORKSPACE_FOLDER env...

@frinzekt
Copy link
Member

do you have steps of replication?

when you run docker compose, it uses the path of the host, isn't it? That other notes seems interesting though

@frinzekt
Copy link
Member

yeah you maybe are right with the local workspace folder env set in https://github.com/codersforcauses/automated-setups/blob/main/cfc-devenv-base/.devcontainer/devcontainer.json

@dct0
Copy link
Contributor Author

dct0 commented Jun 22, 2024

There ended up being (not really) a bug with docker desktop for mac which made it so the bind mounts didn't work microsoft/vscode-remote-release#5388 (comment) in the docker compose. The solution was to use the LOCAL_WORKSPACE_FOLDER env var so I'm thinking it can also be applied to other containers so the bind mounts work properly https://github.com/codersforcauses/django-nextjs-template/blob/main/docker-compose.yml#L6 . Then we can dockerise the entire app which makes running stuff much easier

@frinzekt
Copy link
Member

Are you proposing to use django app dockerised and running in another container?

I'm not opposed to it, but there's a couple of advantages to running django in the devcontainer rather than in another container. Some of the advantages i see are:

  • debugger is directly integrated to the IDE (yes, I would like CFC volunteers to learn how to use debugger of the IDE)
  • the terminal you use to do migrate, and run scripts is the devcontainer with the shell setup

@dct0
Copy link
Contributor Author

dct0 commented Jun 23, 2024

Can confirm I was able to dockerise entire apps with the env var, so I'm closing this issue

@dct0 dct0 closed this as completed Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants