
Lesson Description
The "Using Dev Containers with Docker" Lesson is part of the full, Become a VS Code Power User course featured in this preview video. Here's what you'd learn in this lesson:
Steve explains that dev containers can be used in various ways, such as connecting to Docker containers or remote environments like GitHub code spaces. While dev containers add complexity, they are not necessary for front-end code but can be beneficial for backend development, particularly when dealing with software updates.
Transcript from the "Using Dev Containers with Docker" Lesson
[00:00:00]
>> Steve Kinney: There's a bunch of ways you can use Dev containers. The way that we're gonna play with it today is with some docker containers. You can also connect to a remote environment as well. We are not doing that because then I would have to maintain a remote environment forever.
[00:00:20]
And then Dustin will email me when it goes down. So we're not doing that. But you can connect to things like GitHub, Codespaces, CodeSandbox will actually do it, if you ever use VS Code in the browser. In StackBlitz I think two you can actually connect to them from VS Code as well, which is super cool.
[00:00:44]
You should definitely try it out at some point. The idea of a dev container is, obviously, you need stuff running on your computer, right? And whether or not you need dev containers depends on what stuff you are running. For instance, if you are just purely a front-end engineer, you can probably take a 10-minute nap right now.
[00:01:08]
Generally speaking, sure, you're running a version of node, but that's only being executed once, Vite or Webpack or what have you. Compiles your code to something and probably as long as you are not on an ancient version of Node on your computer, probably good. Where things get more complicated is again, if you do need consistency in the version, if you're running server side code that is a lot more version dependent, right than browser code.
[00:01:38]
Which were, I think if you're writing browser code, the build tools are already ready for the wild world of browsers in a thousand different environments. And so that part of the industry has already dealt with that pain for so long that they've just they're dead inside. If you're doing server code, and you need to be on Node 22.17 because that's what you're using in production and one person on your team is running a different version and then the tests don't pass, nobody wants to deal with that.
[00:02:11]
The other time you need containers is, again, if you're just spinning up a web server. If you need to spin up lots of other things, Postgres, Temporal, which is a bunch of docker containers, like many docker containers. All those things, then all of a sudden, you probably want another setup.
[00:02:34]
But again, the nice part is you are running that code in a little contained environment, not on your computer technically. So other reasons you might wanna use it, you're building AI-agents that are gonna run stuff on the command line, and you'd like to do that in a safe space than on your computer where it can go wild.
[00:02:54]
Right, anything where you want that kind of consistent environment, encapsulated, safe, little place where everyone can be on the same page, you might wanna consider a dev container. Does it add more complexity? It does. If you are just writing front-end code, do you need it? No, I'm not even gonna say it may depend, we probably don't.
[00:03:20]
But if you are worried about, I remember when I did do backend engineering, particularly Ruby before Docker, 10, 11, 12, I don't want to think about this. Every Mac OS update meant you weren't getting anything done for a week. As you reinstall installed Postgres and tried to figure everything out, so on and so forth.
[00:03:43]
You just didn't upgrade your software ever. So that's me now, this is for you. I was like five, I don't know what you want from me. Then, okay, fine. That's, okay, the case too. So it's a way to have a consistent VI. And the nice part is means that everyone is running in that same version, because it is, again, a container that has that version of Node, that version of Postgres, with that auth credential, so on and so forth, all running at the same ports, connected in the same way.
[00:04:16]
Yay, great, right? And what the Dev containers allow you to do is basically, your VS code exists in that world. It's like you're running it on that computer, even though you're running on your computer, everything feels great. It's like one of those things where setting up a basic version, very easy.
[00:04:38]
And we're going to do it together, all of the weird, esoteric parts about your setup are going to be squarely and hard, I'm sorry
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops