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.
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.
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.
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.
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.
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?
@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?
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.
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!
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.
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.
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,
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
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.
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!
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.
@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
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?
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?
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!
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.
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?
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?
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.
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.
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?
@@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.
@@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.
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...
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
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.
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.
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.
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.
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.
Thanks for the kind words!
i agree 100%!
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.
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.
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.
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.
Cool! I am totally looking deeper into Dev Containers to avoid installations pain for our team
Perfect amount of edge-case covered, goated tutorial
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?
Subscribed! The simplicity in presentation, easy going nature, I loved most!
Had to endure watching a few other videos before I found yours. Clear, indepth and Concise the 30 mins flew past..
@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?
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.
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!
Finally I understand why and how to use this stuff 😅
Thanks for this, great overview of dev containers. Didn't know this existed! Will really help my workflow.
Clear and straight to the point. Thank you Dan!
This is magic! Exactly what I needed, thank you!
Such a performance of a fantastic tutorial!!! Good job! Please bring more and more videos like this one! Thank you so much.
Nice video! Thanks! Inspired me to get all that WSL stuff right. WIthout that, the performance can be very underwhelming...
Glad it helped! Yeah it really can get slow across the filesystems. Underwhelming indeed
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.
You explained it in an awesome way! Thanks
Wow, I didn't know about this. Really cool!
Very clear and easy to follow. You are also very engaging! Thanks
Awesome, thank you!
Way excellent video, thanks. I'm going to give it a try.
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.
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,
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
Very VERY cool explanation THANKS!!!
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.
Awesome!!! Thanks much!!!
Realy nice tutorial. Helped a lot! Cheers!
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!
Very helpful, thanks!
Brilliant! Thank you.
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.
This is top shelf stuff right there !!
Thanks for sharing! I love it
uow, so good video! Thank you!
Very good! How do we share ssh key between the container and The host machine?
Awesome video, very clear!
Thanks for this great video. May I know which extension you used to draw flow-chart at around 7:00 minute?
If you look right at the top of his screen, looks like he is using excalidraw
great video. How would you do this for a nx monorepo that has 2 apps in side it with libs?
Thank you for showing this!!!!!!!!!!!!!!!......!!!!!!
I hope the feature helps!
@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
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?
So, to share your custom environment with other team members you would share the .devcontainer directory? How does it work?
I usually commit it to version control. So it is included when someone clones the project repo.
These instructions no longer work. When I do the Clone it just asks me for the branch and then does nothing
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?
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!
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.
Fantastic
Great video❤...
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?
Sometimes later... How do you specify the volume location e.g. /home/dev/projects/proj1
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?
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.
Great Video
Thanks!
a bit late, but how do you deal with updates to dependencies, how does it work?
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.
What is the zsh theme you're using?
It's called powerlevel10k ! github.com/romkatv/powerlevel10k
Thanks!
Nice video
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?
i get the same error, did you ever find a solution?
nice
cool video! thanks
do you have experience with using it in a monorepo like turbo?
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.
@@DanCanCode the monorepo isn't running one container but every app is running in a container. meanin a docker compose and several docker files.
:)
@@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.
@@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.
Checklist driven development
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...
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
Nice :) +1 sub
Subscribe, like and share. This is a really great video!
I can't use docker because of some setting in my bios. I can't find the setting to save my life.
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.
I wish there was a JetBrains version of this
Agreed. The remote ssh and remote containers are one of reasons I eventually moved on from Pycharm
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?
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.
How did you opened your terminal in windows with shortcut?
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.
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.
30 minutes should've been 5 without all the water... don't waste my time please