Working with Multiple Dev Containers in VS Code

Поделиться
HTML-код
  • Опубликовано: 2 авг 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 8 месяцев назад +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

  • @e00d20
    @e00d20 7 месяцев назад

    Cool seeing you here Gwyneth (=

  • @peanut-d-cat
    @peanut-d-cat 4 месяца назад

    thank you!

  • @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?

  • @muhannadalulaby8727
    @muhannadalulaby8727 7 месяцев назад

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

  • @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?

  • @alexanderqwerty
    @alexanderqwerty 6 месяцев назад +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 3 месяца назад +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.

  • @adstr-learning
    @adstr-learning 8 месяцев назад +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

  • @divelix2666
    @divelix2666 5 месяцев назад

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

  • @ishananaguru
    @ishananaguru 8 месяцев назад +2

    how do you customize the terminal like that?

    • @RockTheCage55
      @RockTheCage55 8 месяцев назад +5

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

    • @ishananaguru
      @ishananaguru 8 месяцев назад +2

      @@RockTheCage55 thank you

  • @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 7 месяцев назад +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

  • @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.

  • @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.

  • @manjurulkhan2308
    @manjurulkhan2308 25 дней назад

    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  21 день назад +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 21 день назад

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

  • @AlanDanielx
    @AlanDanielx 8 месяцев назад +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 8 месяцев назад

    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?