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
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 33

  • @RockTheCage55
    @RockTheCage55 7 หลายเดือนก่อน +3

    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

  • @a-di-mo
    @a-di-mo 6 หลายเดือนก่อน +2

    Thx very interesting. Is there an example of communication between the dev containers (client-server) for enabling debugging on each side of solution also?

  • @michaelta05
    @michaelta05 6 หลายเดือนก่อน +3

    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?

  • @e00d20
    @e00d20 7 หลายเดือนก่อน

    Cool seeing you here Gwyneth (=

  • @muhannadalulaby8727
    @muhannadalulaby8727 7 หลายเดือนก่อน

    Thank you so much for a very useful tutoril. Can you please show a demo of using devcontainers with django?

  • @divelix2666
    @divelix2666 4 หลายเดือนก่อน

    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"?

  • @alexanderqwerty
    @alexanderqwerty 5 หลายเดือนก่อน +5

    It's not very clear why a second file docker-compose.devcontainer.yml was added and how it is supposed to work

    • @philsown
      @philsown 4 หลายเดือนก่อน

      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 😂

    •  4 หลายเดือนก่อน +2

      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.

    • @Alperic27
      @Alperic27 3 หลายเดือนก่อน

      @the second is to ensure that DEV vs NON-DEV config elements remain separared in how u use docker compose

    • @khanra17
      @khanra17 2 หลายเดือนก่อน +1

      This is a terribly made video.

    • @WalterSamuels
      @WalterSamuels 2 หลายเดือนก่อน

      @@khanra17 There really needs to be a deep dive into it that covers everything, with real world examples.

  • @peanut-d-cat
    @peanut-d-cat 4 หลายเดือนก่อน

    thank you!

  • @adstr-learning
    @adstr-learning 7 หลายเดือนก่อน +1

    Is it possible to have a dev container depend on a non dev container (like a container for a database?)

    • @codeman99-dev
      @codeman99-dev 7 หลายเดือนก่อน

      Absolutely. Pretty much all of the "postgres" templates do exactly that.

    • @JohnDoe-dt4om
      @JohnDoe-dt4om 7 หลายเดือนก่อน

      to do this you can define a new service in docker compose with a database image. take a look docker_compose definition

  • @rjrimorin
    @rjrimorin 7 หลายเดือนก่อน +2

    when I try to Reopen containers it always add a new devcontainer file not sure what I did wrong with my setup

    • @divelix2666
      @divelix2666 6 หลายเดือนก่อน +1

      I had this problem too, make sure "links" field in compose file has correct service name

    • @jpillstream
      @jpillstream 6 หลายเดือนก่อน

      @@divelix2666Had this problem too, your answer helped me too

  • @ishananaguru
    @ishananaguru 7 หลายเดือนก่อน +2

    how do you customize the terminal like that?

    • @RockTheCage55
      @RockTheCage55 7 หลายเดือนก่อน +5

      I think she is using "Oh My Posh" for powershell

    • @ishananaguru
      @ishananaguru 7 หลายเดือนก่อน +2

      @@RockTheCage55 thank you

  • @GoogleAccount-oi4mw
    @GoogleAccount-oi4mw 2 หลายเดือนก่อน

    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.

  • @manjurulkhan2308
    @manjurulkhan2308 16 วันที่ผ่านมา

    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?

    • @code
      @code  12 วันที่ผ่านมา +1

      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. 😁

    • @manjurulkhan2308
      @manjurulkhan2308 12 วันที่ผ่านมา

      @@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!

  • @WalterSamuels
    @WalterSamuels 2 หลายเดือนก่อน +1

    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.

  • @AlanDanielx
    @AlanDanielx 7 หลายเดือนก่อน +2

    Please add VERTICAL TABS just like in Microsoft Edge! ! ! It's urgent for people with widescreen monitors

  • @jpillstream
    @jpillstream 6 หลายเดือนก่อน

    the docker-compose.devcontainer.yml container-1 doesn't link with container-2?

  • @ShadoFXPerino
    @ShadoFXPerino 7 หลายเดือนก่อน

    I kinda wish there was a way to fetch the codespace secrets to my local using gh cli or something

    • @shazzz_land
      @shazzz_land 6 หลายเดือนก่อน

      meaning export work environment skin arrangement and settings? can t you do that?