My Favorite Way To Handle Dev Environments | VS Code Devcontainers

Поділитися
Вставка
  • Опубліковано 22 лис 2024

КОМЕНТАРІ • 98

  • @such-ej
    @such-ej Рік тому +59

    It was an impressive video. The length of 30 minutes may be confusing at first, but it's worth watching. Everything is explained in an accessible manner, logical and consistent. If all tutorials were at this level, we would live in a different, better world.

  • @makoswebdev7382
    @makoswebdev7382 Рік тому +6

    Dan, your video was a lifesaver! I spent the entire day wrestling with the slow system problem you've mentioned , only to discover through your tutorial that the root of my troubles was cloning the repo into my local Windows file system. Your guidance was invaluable - thank you once more.

  • @brianvarren
    @brianvarren Рік тому +15

    Thank you for leaving the errors and solutions in. I also appreciate the somewhat informal style, it's like getting help from a friend, vs sitting in an overcrowded lecture hall. I learned a lot. Subscribed.

  • @NelCapeTown
    @NelCapeTown Рік тому +3

    So happy when the UA-cam algorithm finds gold for me. It is easy to get sidetracked into how the Universe sends you information you request on a philosophical level, but this explanation is so exactly what I needed and it popped up in my feed rather than specific search results. Spot on. Looking forward to seeing your other work.

  • @iotbits
    @iotbits 10 місяців тому

    Great tutorial, you explained all the steps, mostly tutors or experienced people assume the viewer knows some steps which is not always true, I appreciate your extra efforts explaining each step thoroughly. Thanks.

  • @wattsfield1889
    @wattsfield1889 10 місяців тому

    Cool! I am totally looking deeper into Dev Containers to avoid installations pain for our team

  • @Malix_Labs
    @Malix_Labs 9 місяців тому +1

    Perfect amount of edge-case covered, goated tutorial

  • @rishabhsaxena9357
    @rishabhsaxena9357 Рік тому +1

    Nice video!!
    I've some questions:
    1. How to share the dev container to a co-worker?
    2. If I add PostgreSQL as a database in my dev container, how will I access it using softwares like PgAdmin/Dbeaver?
    3. If I have my backend running on my local windows machine serving some APIs and my angular frontend application running in dev container, how will frontend communicate to the backend?

  • @devendrahaldankar8535
    @devendrahaldankar8535 4 місяці тому

    Subscribed! The simplicity in presentation, easy going nature, I loved most!

  • @detprest8975
    @detprest8975 Рік тому

    Had to endure watching a few other videos before I found yours. Clear, indepth and Concise the 30 mins flew past..

  • @clusterdriven
    @clusterdriven 11 місяців тому +1

    @DanCanCode, let's say you are in a devcontainer, you do some work, run git add, commit, and push. Now you realize your ssh keys are missing inside the container as they only exist in your local machine and thus you can't push code. How would you go around this issue?

  • @ksh6
    @ksh6 Рік тому +2

    Excellent video. It explained everything I wanted to know about this in a simple way. You have perfect voice and talent for these type of videos. Keep making, your videos will go viral over time.

  • @RajaSachithanantham
    @RajaSachithanantham Рік тому

    Thank you, Dan, for this incredibly informative and detailed tutorial on setting up a development environment using Visual Studio Code's Dev Containers. Your explanations were clear and easy to follow, and I appreciate how you addressed the challenges of reproducing the environment and onboarding new team members. The step-by-step instructions, along with the demonstrations, made it much easier for me to understand and implement this approach. I also liked how you highlighted the customization options and the integration with GitHub code spaces. This tutorial has been incredibly helpful, and I'm excited to apply this knowledge to my own projects. Keep up the great work!

  • @slowjocrow6451
    @slowjocrow6451 8 місяців тому

    Finally I understand why and how to use this stuff 😅

  • @deandunn206
    @deandunn206 Рік тому

    Thanks for this, great overview of dev containers. Didn't know this existed! Will really help my workflow.

  • @SouhaibD
    @SouhaibD Рік тому +1

    Clear and straight to the point. Thank you Dan!

  • @mykola2173
    @mykola2173 Рік тому

    This is magic! Exactly what I needed, thank you!

  • @ChrisCheng-en4nw
    @ChrisCheng-en4nw Рік тому

    Such a performance of a fantastic tutorial!!! Good job! Please bring more and more videos like this one! Thank you so much.

  • @phreakadelle
    @phreakadelle Рік тому +3

    Nice video! Thanks! Inspired me to get all that WSL stuff right. WIthout that, the performance can be very underwhelming...

    • @DanCanCode
      @DanCanCode  Рік тому +2

      Glad it helped! Yeah it really can get slow across the filesystems. Underwhelming indeed

  • @videotalks
    @videotalks Рік тому +1

    It was a wonderful video to learn about dev-containers. I'm a hobby developer and always into multiple projects with kinda same toolset. So, I was looking forward to getting another video from you where we can create one dev container in VS Code and use it for multiple projects? It would be a nice follow up to this one. Thanks.

  • @mahsaamiri9243
    @mahsaamiri9243 5 місяців тому

    You explained it in an awesome way! Thanks

  • @JamesQQuick
    @JamesQQuick 8 місяців тому

    Wow, I didn't know about this. Really cool!

  • @digitaldisruptlabs
    @digitaldisruptlabs Рік тому

    Very clear and easy to follow. You are also very engaging! Thanks

  • @kenchang3456
    @kenchang3456 11 місяців тому

    Way excellent video, thanks. I'm going to give it a try.

  • @rujor
    @rujor Рік тому

    Very nice walkthrough! It would be very useful to know how to setup container access to localhost, in cases where dev-servers (SQL/Redis etc.) are running there.

  • @EngineeringVignettes
    @EngineeringVignettes Рік тому +1

    Thanks for the overview, it seems a good way to knock up a build environment if your needs can fit into a prebuild "canned" image.
    It seems it is running git operations in the container. How is it importing .git-credentials and .gitconfig into the container?
    On my hand-built containers i usually mount .gitconfig etc from my home dir and then I get access to those settings, PATs etc.
    It would also be interesting to see how the dev containers system overcomes the "docker user ID problem", we use a little trick on our containers to override the default user in the container with the outside user's uid (groupmod, usermod) when the container is first started..
    Cheers,

    • @DanCanCode
      @DanCanCode  Рік тому +1

      I think you can make custom Dockerfiles and use the system. I know you can modify them.
      It *might* be syncing git preferences through VS Code's GitHub sign in. I'm certain it's doing that for credentials. I haven't had to install the GitHub CLI or mess with persisting credentials on linux in all those other ways.
      Docs for how the user id thing is handled in devcontainers: code.visualstudio.com/remote/advancedcontainers/add-nonroot-user
      Love the Fallout vault boy avatar

  • @geraldbullardjr
    @geraldbullardjr Рік тому

    Very VERY cool explanation THANKS!!!

  • @RonWaller
    @RonWaller Рік тому

    New to docker containers and container development. Curious can you customize the linux environment to run like your "home" setup? (similar terminal setup etc etc), also Can you create a "template" dev container when created the based is the same every time? (sort of pertaining to my pervious question. As to not be spending time setting up the environment to your liking for each and every dev container). I sure hope you get what I meant. lo.

  • @ai.aspirations
    @ai.aspirations Місяць тому

    Awesome!!! Thanks much!!!

  • @maqloch
    @maqloch Рік тому

    Realy nice tutorial. Helped a lot! Cheers!

  • @艾曦-e4g
    @艾曦-e4g Рік тому

    I have to say "thanks" for your excellent video, I love it. I think the default Linux repo is OK! But, I just want to use different tools such as zsh, bat, riggrep, etc. Maybe, we can use nix and flakes to provide more config options in the same image for different projects. Do you know something similar or how to achieve that goal? Thanks a lot!

  • @vitcosoft
    @vitcosoft 7 місяців тому

    Very helpful, thanks!

  • @ahmedelrewaidy6049
    @ahmedelrewaidy6049 Рік тому +1

    Brilliant! Thank you.

  • @fromnsk
    @fromnsk 3 місяці тому

    Cool stuff, thanks!
    But ChatGPT says the following about "Dev Containers: Open Folder in Container":
    When you use "Dev Containers: Open Folder in Container", VS Code is actually working directly inside the container's environment. This means:
    No Cross-Environment File Sync: You’re not syncing files between Windows and Linux; instead, you’re directly editing files in the Linux environment of the container.
    Performance: Since everything happens within the container, performance should not be significantly impacted. There's no constant file transfer between Windows and Linux because the file system you're working with is entirely inside the container.

  • @dekooks1543
    @dekooks1543 Рік тому

    This is top shelf stuff right there !!

  • @frankfu1122
    @frankfu1122 Рік тому

    Thanks for sharing! I love it

  • @marioarmagni6498
    @marioarmagni6498 Рік тому

    uow, so good video! Thank you!

  • @rangue
    @rangue Рік тому

    Very good! How do we share ssh key between the container and The host machine?

  • @speppucci
    @speppucci Рік тому

    Awesome video, very clear!

  • @breezewang6344
    @breezewang6344 Рік тому

    Thanks for this great video. May I know which extension you used to draw flow-chart at around 7:00 minute?

    • @soorbus
      @soorbus 3 місяці тому

      If you look right at the top of his screen, looks like he is using excalidraw

  • @Adhocfan
    @Adhocfan 6 місяців тому

    great video. How would you do this for a nx monorepo that has 2 apps in side it with libs?

  • @ChadE1020
    @ChadE1020 Рік тому +1

    Thank you for showing this!!!!!!!!!!!!!!!......!!!!!!

  • @markortiz2679
    @markortiz2679 Рік тому

    @DanCanCode, what happen if we need most updated version of java for example but the available base workspace is still using an old version, is there a way to tell devcontainer to use latest or different version of java? Thanks

  • @CryptoBuilders
    @CryptoBuilders 7 місяців тому

    Hey dan, if i configured already WSL2 and Ubunto on my widnows OS, wouldnt be better to install directly docker desktop for linux instead of windows version?

  • @Flackon
    @Flackon Рік тому +1

    So, to share your custom environment with other team members you would share the .devcontainer directory? How does it work?

    • @DanCanCode
      @DanCanCode  Рік тому

      I usually commit it to version control. So it is included when someone clones the project repo.

  • @paulwozere
    @paulwozere 4 місяці тому +1

    These instructions no longer work. When I do the Clone it just asks me for the branch and then does nothing

  • @aternous
    @aternous Рік тому

    Hi, with the method, how do I close VS Code (and stop the container after having checked in) and come back later on and automatically have the container started for me where I left off OR quickly start things up with a simple command to get back to where I was? Do I have to clone each time? Cant I start the container and VS Code automatically jump to the session in the container? What's the quickest way to get back to the state I left the application?

  • @mr_broombroom
    @mr_broombroom Рік тому +1

    Awesome video!
    Is there a way to connect from vscode to the dev container again besides using opening the recently opened in the welcome screen? When I try to do so, I can't see the files.
    Also: do I have to clone again when I destroyed the container?
    Keep up the good work!

    • @DanCanCode
      @DanCanCode  Рік тому +2

      Try the Remote Explorer icon on the activity bar? I think it lists containers, code spaces, ssh connections.
      You may have to re-clone if you destroyed it in docker. You could still get to the files in the volume it mounted if still available.
      Closing the window or turning off the container is not the same as destroying it. Just in case, thought I'd mention.

  • @utkarshkukreti239
    @utkarshkukreti239 Рік тому

    Fantastic

  • @siddhartroy4409
    @siddhartroy4409 Місяць тому

    Great video❤...

  • @exciteresearch
    @exciteresearch 6 місяців тому

    Hey Dan and Dan's community, I've been testing VSCode and Devcontainers in WSL/Docker for the last four days but I'm having a problem with "Build repository in devcontainer" using a Bitbucket Repository which hangs in the terminal when requesting permission to add the Bitbucket server to known_hosts. It just hangs and doesn't take the 'yes' keystrokes for input. Does anyone else have a solution?

  • @JeanPhilippeMaquestiaux
    @JeanPhilippeMaquestiaux Рік тому

    Sometimes later... How do you specify the volume location e.g. /home/dev/projects/proj1

  • @jimmydfgh8805
    @jimmydfgh8805 10 місяців тому

    I am trying to build an image using docker and the dockerfile is in the directory. docker extension is already installed. But when I build, the command line says "bash: docker: command not found". I don't know whether it is an image problem, sometimes I don't have the issue and sometimes I do. Any suggestions?

    • @jimmydfgh8805
      @jimmydfgh8805 10 місяців тому

      Ah, I just discovered that Docker is not installed by default in the image and I need to install myself. And the docker extension is a different thing altogether. Thank you.

  • @marcjacobreyes
    @marcjacobreyes Рік тому +1

    Great Video

  • @mikevaleriano9557
    @mikevaleriano9557 Рік тому +1

    a bit late, but how do you deal with updates to dependencies, how does it work?

    • @DanCanCode
      @DanCanCode  Рік тому

      Good question! Project dependencies are handled as normal, for instance you would run `npm install` in the terminal (it runs inside the container). If you update a dependency in the container's dockerfile, there's a command to rebuild the container. I think VS Code prompts you when a change is detected.

  • @rogalaharacz
    @rogalaharacz Рік тому +1

    What is the zsh theme you're using?

    • @DanCanCode
      @DanCanCode  Рік тому +1

      It's called powerlevel10k ! github.com/romkatv/powerlevel10k

    • @rogalaharacz
      @rogalaharacz Рік тому

      Thanks!

  • @517Amit
    @517Amit Рік тому

    Nice video

  • @stuartbiggs1278
    @stuartbiggs1278 Рік тому

    When I try to clone the container, I get an error message saying "error occurred setting up the container. Is there any chance that you could look into this please?

    • @rohansaibuddhi5280
      @rohansaibuddhi5280 5 місяців тому

      i get the same error, did you ever find a solution?

  • @mannb1023
    @mannb1023 17 днів тому

    nice

  • @b1chler
    @b1chler Рік тому

    cool video! thanks
    do you have experience with using it in a monorepo like turbo?

    • @DanCanCode
      @DanCanCode  Рік тому

      If the entire mono repo is in the container I think it shouldn't be any different. I do have a turborepo and sometimes use it in the dev container.

    • @b1chler
      @b1chler Рік тому

      @@DanCanCode the monorepo isn't running one container but every app is running in a container. meanin a docker compose and several docker files.
      :)

    • @BTCruiser2011
      @BTCruiser2011 Рік тому

      @@b1chler probably more complicated than it's worth then. Not sure how you'd get turborepo to communicate across the container boundary. I suppose you could try docker-in-docker, but sounds messy.

    • @pwii
      @pwii Рік тому

      @@b1chler You just need to have docker installed in the devcontainer and add a bind mount to the host's /var/run/docker.sock. The containers will be created on the host machine, but you might need to do some setup with docker networks if the app containers need to be accessible from the devcontainer.

  • @Neo-zy5vg
    @Neo-zy5vg Рік тому

    Checklist driven development

  • @alan-
    @alan- Рік тому +1

    That was a great tutorial, very clear and concise, thanks. I've subscribed and am going to commence binge-watching your other videos which all look interesting. React+Vite next...

  • @DavidSuárez-y2s
    @DavidSuárez-y2s 11 місяців тому +1

    I prefer to create my own Docker Compose with bind mounts to my repo code, and then use the VSCode's "attach to running container" functionality. Way easier, and without boiler plate. In this video they explain how easy it is to attach: ua-cam.com/video/8gUtN5j4QnY/v-deo.html&ab_channel=Code2020

  • @davidhughes3834
    @davidhughes3834 6 місяців тому

    Nice :) +1 sub

  • @couffin
    @couffin Рік тому

    Subscribe, like and share. This is a really great video!

  • @clamhammer2463
    @clamhammer2463 Рік тому

    I can't use docker because of some setting in my bios. I can't find the setting to save my life.

    • @EngineeringVignettes
      @EngineeringVignettes Рік тому

      You need to enable hypervisor support in the BIOS?
      Also have to start the Windows 10/11 hypervisor (google Enable Hyper-V on windows)
      Both WSL and Docker will now use the Windows Hypervisor which makes things a lot easier now. The only possible glitch is if you are also running a VM, it may be incompatible.

  • @esra_erimez
    @esra_erimez Рік тому +2

    I wish there was a JetBrains version of this

    • @DanCanCode
      @DanCanCode  Рік тому

      Agreed. The remote ssh and remote containers are one of reasons I eventually moved on from Pycharm

  • @abdullahalrashidi497
    @abdullahalrashidi497 Рік тому

    when I install an extension and restart the container it doesn't persist so I need to reinstall it again! what's I'm doing wrong?

    • @DanCanCode
      @DanCanCode  Рік тому

      Hmm, I've not experienced this issue. I do know for some extensions you have to go to your extensions list and hit "install in remote". Could be worded differently, but some extensions need to run server-side.

  • @manee427
    @manee427 Рік тому

    How did you opened your terminal in windows with shortcut?

  • @Azeemhassan-i2k
    @Azeemhassan-i2k 9 місяців тому

    i search all over the youtube there is no one tell the solution how we will manage "nodemon" with devcontainer, not just nodemon but same next.js, vue.js, laravel vite.

  • @RajinderYadav
    @RajinderYadav 11 місяців тому

    This is stupid to copy files into a devcontainer? with docker you can just mount the volume into the container of the local host system. So basically devcontainer is for people too lazy to learn a few basic docker commands? ewwwe so I have to now put a dockerfile into a vscode type json file? 😂 ...oh ya much easier. Now some clown developer needs to read both dockerfile and devcontainer json file manuals and other configurations info when you get past some simple hello world setup.

  • @xaas
    @xaas 4 місяці тому

    30 minutes should've been 5 without all the water... don't waste my time please