Working with Multiple Dev Containers in VS Code
ฝัง
- เผยแพร่เมื่อ 24 ก.ค. 2024
- Experience consistency, portability, and reproducibility with Dev Containers. In this video, we'll see how we can work with multiple Dev Containers in VS Code.
Dev Containers Extension: aka.ms/DevContainersExtension
Demo Project: github.com/madebygps/multiple...
Docs: code.visualstudio.com/remote/...
tools and services that currently support the Development Container Specification: containers.dev/supporting
0:00 Dev Containers Overview
0:59 Demo Project Structure
2:42 Docker Compose Overview
3:38 devcontainer.json Overview
5:11 Working with one VS Code window
7:06 Working with multiple VS Code windows
8:36 Extending your docker compose
9:16 Summary - วิทยาศาสตร์และเทคโนโลยี
Thank you very much for this video. I searched on how to do this for hours one night (& tweeted multiple people with no replies) and just thought it wasn't possible: multiple devcontainer files
Thx very interesting. Is there an example of communication between the dev containers (client-server) for enabling debugging on each side of solution also?
Thank you so much for the video! But not sure why I can't complete the rest... I cloned the project, opened vscode at the project root, pressed F1 and selected Dev Containers: Reopen in Container, then I picked Python Container but vscode kept on asking to Add Dev Container Configuration Files, From a predefined container configuration definition..., From 'docker-compose.yml', Learn More... What did I do wrong?
Cool seeing you here Gwyneth (=
Thank you so much for a very useful tutoril. Can you please show a demo of using devcontainers with django?
Is it possible to mount subfolder instead of repo's root? I tried to change "." to "./local/path" in compose file, but VScode couldn't create workspace. Is it hardcoded to ".:/workspace"?
It's not very clear why a second file docker-compose.devcontainer.yml was added and how it is supposed to work
I'd like more detail on that too. Do services in the 2nd one override services in the 1st? Or are the definitions combined? I'm glad you asked and it's not just me 😂
The files are combined according to yaml rules. There are quirks, but essentially they merge/combine.
The usual flow is to have something that defines how it usually runs and then have the other to define your overrides.
One example would be that you want your development override to mount the current folder as a volume in the container, so that code edits propagate between the containers and host. If you have a dedicated test compose file, then you can easily create stacks that run tests while you do other things.
@the second is to ensure that DEV vs NON-DEV config elements remain separared in how u use docker compose
This is a terribly made video.
@@khanra17 There really needs to be a deep dive into it that covers everything, with real world examples.
thank you!
Is it possible to have a dev container depend on a non dev container (like a container for a database?)
Absolutely. Pretty much all of the "postgres" templates do exactly that.
to do this you can define a new service in docker compose with a database image. take a look docker_compose definition
when I try to Reopen containers it always add a new devcontainer file not sure what I did wrong with my setup
I had this problem too, make sure "links" field in compose file has correct service name
@@divelix2666Had this problem too, your answer helped me too
how do you customize the terminal like that?
I think she is using "Oh My Posh" for powershell
@@RockTheCage55 thank you
Cool, But what if a container1 is a git repository and container2 is another git repository. Now i want to create a 3rd repository only for the devcontainer environment, but I want to keep the container1 and container2 separately so i could work on it using git in the devcontainer.
Good video, but the containers are not exactly working WITH each other as in they are not communicating with each other. For example, how would I use a base dev container for Nodejs/Typescript and combine that with a android-docker container so that I can invoke android build commands from a react native project in the first container?
If they are networked together, this should work. It can be tedious to get it setup, we know. Check the docs at containers.dev and use ChatGPT - it knows a lot about networking Docker containers. 😁
@@code Thanks! :) . Yes, I figured out in the end that everything that applies to Docker also applies to dev containers. Should have been very obvious!
Seems kinda gross to have to switch back and forth. Would make more sense if they were both visible in the files explorer at the same time, and the one window showed all of the connected containers down the bottom left bar.
Please add VERTICAL TABS just like in Microsoft Edge! ! ! It's urgent for people with widescreen monitors
the docker-compose.devcontainer.yml container-1 doesn't link with container-2?
I kinda wish there was a way to fetch the codespace secrets to my local using gh cli or something
meaning export work environment skin arrangement and settings? can t you do that?