
Teach Jenn Docker Basics
Anthony returns to Teach Jenn Tech to explain Docker including how to create Docker images, build containers, and run Node.js servers from scratch
Episode Description
Jenn and Anthony walk through Docker basics by building and running a containerized Node Express server, discussing images, containers, and dev workflow tips.
Episode Summary
In this episode of Teach Jenn Tech, Anthony Campolo joins Jenn Junod to guide her through a hands-on Docker tutorial. After catching up on the tech streaming community and discussing their experiences with TypeScript, Discord servers, and content creation workflows, they pivot to the main topic: understanding Docker. Anthony explains the difference between Docker images and containers, noting that definitions only truly click after doing the work. They build a simple Node Express server, write a Dockerfile with Alpine Linux, and walk through each instruction — from setting the working directory and copying the package JSON to installing dependencies and exposing a port. Jenn successfully builds the image, runs the container, and views her app in the browser. Along the way, they compare Docker to running Postgres locally (which Anthony advises against), touch on how Kubernetes relates to Docker as an orchestration layer for multiple containers, and discuss why deploying databases on services like Railway avoids common port conflicts and ephemeral storage pitfalls. The episode wraps with Jenn committing her project to a public GitHub repo, reinforcing the importance of documentation and readmes as learning artifacts.
Chapters
00:00:00 - Introductions and Community Catch-Up
Anthony opens the show with an energetic introduction of both hosts, shouting out their respective roles — Jenn as a developer advocate at Aiven working with databases, APIs, and Kafka, and Anthony as a developer advocate at Edgio. They joke about radio-style "station breaks" inspired by their friend Scott, and Jenn previews the week's streaming schedule, which includes Docker basics, data fundamentals with Ben Gamble, and a recurring TypeScript session with Josh Goldberg.
The conversation shifts to TypeScript opinions, with Anthony admitting he has avoided writing TypeScript throughout his career. Jenn shares how working through Josh Goldberg's book helped her realize she already knew many concepts but lacked the vocabulary, using modules as a key example. Anthony clarifies the general definition of a module versus its TypeScript-specific usage, setting the tone for the educational style of the episode.
00:06:12 - Streaming Community, Discords, and Content Workflows
Jenn reflects on nearly a year of Teach Jenn Tech and the challenge of transitioning from "learning" to "knowing" a topic. Anthony shares his ranked list of Discord servers, highlighting communities like Lunch Dev, Theo's server, and Show My Chat. They discuss the value of B Dougie's Secret Sauce interviews and how building relationships in the streaming community often revolves around collaboration opportunities rather than casual conversation.
The hosts also talk about YouTube content management, with Jenn explaining her workflow of streaming on Twitch, downloading the VOD, and manually uploading to YouTube. Anthony suggests building an episode archive on her website as a single source of truth with links, descriptions, timestamps, and guest information, noting that organizing roughly 80 streams is a significant but worthwhile project.
00:15:27 - Docker Overview and Key Concepts
Anthony frames Docker as an extremely confusing but now ubiquitous tool, sharing that it took him weeks to research and write a simple tutorial. He outlines the plan: create a Node Express server returning a single HTML heading, containerize it, and run it locally. He distinguishes between using Docker for databases (like Jenn's Postgres setup) versus running application code, warning that deploying production databases in ephemeral Docker containers is risky.
They use ChatGPT to define Docker images and containers, with Anthony explaining that an image is a software package with everything needed to run code, while a container is a running instance of that image. Jenn shares her mental model comparing images to GitHub project folders, and Anthony refines it by emphasizing the Dockerfile as the instructions that define how the image is built. He advocates for learning by doing rather than getting stuck on definitions.
00:26:30 - Creating the Project and Writing the Dockerfile
The hands-on portion begins as Jenn creates a project folder, initializes a package JSON, and sets up three files: an Express server in JavaScript, a Dockerfile, and a dockerignore. Anthony walks through the Dockerfile line by line, explaining the Alpine Linux base for a lightweight image, the working directory setup, copying the package JSON, running npm install, copying application code, exposing port 8080, and defining the run command.
Jenn notes which lines she would and wouldn't have understood on her own, highlighting Alpine and the copy steps as particularly confusing for newcomers. Anthony emphasizes that the Dockerfile mirrors the same workflow developers use locally — creating a directory, installing dependencies, and running a server — but packages it into a reproducible container that anyone can use.
00:46:07 - Building, Running, and Inspecting the Container
With Docker Desktop running, Jenn builds her image and views the list of existing images in the terminal. Anthony explains the docker run command, including port mapping from 8080 to 49160 and detached mode. They verify the container is running, check the logs, and open the app in a browser to confirm it works. Jenn also uses curl to inspect the raw HTTP response and headers.
They explore Docker Desktop's GUI, clicking through container details, the terminal, files, and stats tabs. Jenn mentions that clicking the container name rather than the image or port columns is a non-obvious UX detail for beginners. Anthony reinforces that the five Docker commands covered — build, images, run, ps, and logs — are sufficient for most developers starting out.
00:50:06 - Docker vs. Kubernetes and Theory vs. Practice
Jenn explains her mental model of Docker and Kubernetes, comparing Docker to a virtual machine (while acknowledging it isn't one) and describing Kubernetes as multiple interconnected containers that provide redundancy and elastic scaling. Anthony affirms her understanding and shares that he spent years working only with Docker and never needed Kubernetes, cautioning that attempting Kubernetes without solid Docker fundamentals leads to frustration.
They discuss the balance between theory and hands-on learning, with Jenn arguing that high-level context helped her understand why she was performing each step, while Anthony maintains that doing the exercise first often makes definitions click faster. Both approaches prove complementary, and they encourage viewers to find whatever balance works for their learning style.
01:01:00 - Git Setup, Documentation, and Wrap-Up
Jenn commits the project to GitHub, initially making it private before Anthony nudges her to switch it to public as a learning resource. They create a gitignore for node_modules and DS_Store, add a readme by pasting Anthony's gist, and attach a stream screenshot. Anthony stresses the value of readmes and documentation as both personal reference and community contribution.
The episode closes with shout-outs to community members in the chat, a nod to the many concurrent streams happening that day, and a plug for the JavaScript Jam Twitter space. Jenn raids B Dougie's stream, sending viewers off to continue learning and supporting fellow creators in the tech streaming community.
Transcript
00:00:01 - Jenn Junod
Welcome. Wow.
00:00:02 - Anthony Campolo
Welcome.
00:00:03 - Jenn Junod
Wow, Anthony, you're like the. Our very first episode. I totally butchered saying hello as well, so. Can I blame you for this?
00:00:12 - Anthony Campolo
Must have jinxed you. I guess I'm cursed. Well, I can introduce you.
00:00:18 - Jenn Junod
Yes.
00:00:19 - Anthony Campolo
Welcome to Teach Jenn Tech with Jenn Junod and Anthony Campolo. Jenn's a developer advocate at Aiven, where she teaches people about databases and APIs and even Kafka. And my name is Anthony Campolo. I'm a developer advocate at Edgio, where we deploy sites that are fast.
00:00:38 - Jenn Junod
I am keeping that clip forever. That was marvelous. Thank you, Anthony.
00:00:45 - Anthony Campolo
Scott. Too much. He's rubbing off on me.
00:00:49 - Jenn Junod
Oh, my gosh. He is so good at doing, like, the.
00:00:52 - Anthony Campolo
Bringing the energy. Yeah, yeah. Radio voice. Yeah.
00:00:56 - Jenn Junod
And always bringing it up during the streams or during the Twitter spaces. Yeah, you're good.
00:01:04 - Anthony Campolo
Yeah. It's his primary job. He does. We call him the station breaks. You have a specific term for when you stop the conversation. You let everyone know you gotta go follow the people who are on the space and that we're talking about this. And now if you're a beginner or you're just in the crowd and you want to chat, come up and chat. He always hits those three points every single time at a station break.
00:01:23 - Jenn Junod
Oh, I like it. Station breaks. I dig it. I dig it.
00:01:26 - Anthony Campolo
That's super smart.
00:01:28 - Jenn Junod
Okay, y'all, we are doing. We're doing things today. We are learning about Docker, which is funny. And I keep doing this. Of doing things very, very backwards. Of I will learn about, you know, something. Try to do something really technical like Anthony's. In my first stream was making a React web app I have on Vercel, where I barely had any idea what JavaScript was.
00:02:03 - Anthony Campolo
But you had at the end of that stream. That's the most important part.
00:02:07 - Jenn Junod
I did. Today we are going over the basics of Docker. I set it up on my computer about two weeks ago as I've been learning about Postgres. Then we also for the rest of this week, I have Ben coming on tomorrow. Ben Gamble. And we're going to be talking about the basics of data. So I like that this week we're kind of like taking a step back on two of the streams. And then Friday is TypeScript day. I like TypeScript day.
00:02:38 - Anthony Campolo
You have TypeScript day every week.
00:02:40 - Jenn Junod
Every other week.
00:02:41 - Anthony Campolo
Every other week, yeah. So you know more TypeScript than me right now, then. No, no, I'm serious. I've gotten away with not writing TypeScript my entire career. It's been a rare privilege of Being a dev rel who creates his own templates and projects is that I just built everything in JS and no one can tell me otherwise.
00:03:03 - Jenn Junod
Okay, okay, I am typing this out to you for the chat.
00:03:09 - Anthony Campolo
Which people right now are hearing me that. And they're like, I hate this guy. How dare he write JavaScript and force others to deal with his JavaScript. And I'm like, how dare you force people to deal with your TypeScript? Is what I would say that I
00:03:20 - Jenn Junod
really like, I think, surprisingly. And Josh knew this. Josh Goldberg, for those who may not know, is the author of this book.
00:03:30 - Anthony Campolo
He's been on my podcast. Technically, the episode is not aired yet, which I feel terrible about because it's been a really long time, but it will air soon, the next month or two.
00:03:40 - Jenn Junod
Everyone please excuse my sniffles, but because they're not going away, it is very springy here. This week we actually get to start going over part two. Functions.
00:03:54 - Anthony Campolo
There you go. Functions is the most important part because that's going to map a lot closely to what you do with a React app, where you have a bunch of functions that you're tossing around. You want to make sure they're type safe.
00:04:05 - Jenn Junod
It's very cool doing this because the questions I ask. Josh knows that it's from when I don't know JavaScript that well, or I know it in JavaScript, yet I don't know the name of it. So that's been a huge piece of. Going through this with him has been, oh, I do know how to do this. It's just. I didn't know.
00:04:30 - Anthony Campolo
Slightly more complicated and with a couple extra steps.
00:04:33 - Jenn Junod
No, a lot of times it's been something I've done. I just had no idea that's what the name of it was.
00:04:38 - Anthony Campolo
Ah, interesting. Yeah. Do you have an example of that, like a thing that you didn't know the name of?
A module? A module, yeah. Okay, cool. Yeah, that's an important one.
00:04:52 - Jenn Junod
And if I understand a module, it's basically where it's like a little subsection that it uses your information and that you get types from. So it's like. Can be a list of like. So I was using it in my. One of my Astro layouts websites that already had TypeScript set up and it had a list of all of its types and each like section of them are a module.
00:05:20 - Anthony Campolo
So a module is more general than types at all. A module is just a chunk of JavaScript code or TypeScript code in one place. You want to import into another place. So you could have a JavaScript module with no types whatsoever being imported from one file into another file. So that's like the. That's the general definition of module, but in terms of, like, what you're talking about, importing types one place to another, that's like a use case of a module. I don't know if that makes any sense.
00:05:48 - Jenn Junod
It does, it does.
00:05:49 - Anthony Campolo
Great.
00:05:49 - Jenn Junod
And that is one of the parts that I found so interesting of my podcast that I was interviewed on is they were like, hey, so what type of tech do you do?
00:06:04 - Anthony Campolo
You do databases and event queues and JavaScript is what you do now. That's your answer. Embrace it.
00:06:12 - Jenn Junod
I was just like, I know some TypeScript and some Python.
00:06:19 - Anthony Campolo
You should tell people that you're the inventor of Postgres is what you should tell people when they ask you.
00:06:26 - Jenn Junod
No.
00:06:26 - Anthony Campolo
Then they'll be so confused, they won't even know what to say. I'm kidding. But I work for a database company.
00:06:32 - Jenn Junod
Yeah. Which is yes. Yes. So it's a lot of like, oh, my gosh, I can't believe it's been like, almost a year. We are, like, two months away from it being a year since Teach Jenn Tech is launched, which is bananas.
00:06:47 - Anthony Campolo
The date, Teach Jenn Tech, it started July 1st.
00:06:52 - Jenn Junod
You were on July 5th.
00:06:55 - Anthony Campolo
Fifth. That was a. So this is nine months ago, 2022. Oh, good times.
00:07:05 - Jenn Junod
It's only because I remember you were my second episode and you. Was on Friday the 1st, and then you are on Tuesday. That's the only reason I remember that. And it's crazy because that goes into the language that I'm learning to say, because the last year I've been like, oh, I'm learning xyz. Well, at one point you learn and then you can actually talk about it. So you actually know it. You're not just learning it. And I didn't know how to talk about that, but that is. Okay, well, we can. We can move in to the darkness.
00:07:49 - Anthony Campolo
Well, let me drop this in a couple discords real quick in case someone wants to come hang out. I feel lonely. There's no one in the chat right now.
00:07:58 - Jenn Junod
Well, I think it's because everyone else decided to stream at the same time. B Dougie is streaming. Rizzell is streaming. Ramon is streaming. Josh is streaming.
00:08:09 - Anthony Campolo
How dare B Dougie stream right now.
00:08:12 - Jenn Junod
We are, like, all streaming at the same time. And this is one of the best and worst parts about being friends with streamers is nine times out of ten, you have something to go Watch.
00:08:25 - Anthony Campolo
I'm especially bummed because I would be watching B. Dougie's stream right now. He hasn't streamed and has been very sporadic in the last three months. And his was the first stream I ever watched. I started watching B. Dougie's stream two years ago. It was the first Discord I was ever in.
00:08:38 - Jenn Junod
That's crazy. I love how with Discords you just kind of end up. One of the things you did was try not to overwhelm me with Discord.
00:08:47 - Anthony Campolo
I hear if you do like one discord every couple weeks. Yeah, yeah.
00:08:51 - Jenn Junod
And I'm not very active in any
00:08:54 - Anthony Campolo
of them, but they're there now and you have resources if you need them. That's the important.
00:08:59 - Jenn Junod
But I'm only active in one Discord and it's the open source Raid Guild.
00:09:08 - Anthony Campolo
Jacobs is cool.
00:09:09 - Jenn Junod
Jacobs.
00:09:09 - Anthony Campolo
I mean that one. I don't. I'm not active at all in it though.
00:09:12 - Jenn Junod
Yeah, like that is my go to. Like I always ask questions there.
00:09:17 - Anthony Campolo
Yeah. So mine, I have ranked honestly, because it's top to bottom. You rank it whether you realize it or not. My ranking is RedwoodJS, so that's going to be on top even though I don't hang out in it very much. Then Lunch Dev, then Theo's Discord, then Swyx's Discord, then OpenSauced Brian's Discord, then Show My Chat, which is not super active but has the best collection of tech streamers that exists. Yeah, that one's gonna blow up one day. And then Nick Taylor's Discord. [unclear].
00:09:52 - Jenn Junod
Wait, Nick Taylor has a Discord?
00:09:53 - Anthony Campolo
He does. I'll send you an invite. And then Learn, Build, Teach, which is James Q. Quick's Discord. And then Unicorn Utterances is a new one I just joined. We'll see on Corbin. Corbin's Discord. Corbin Crutchley. Corbin Discord too. Trash's Discord and then Friend Horse. I feel bad because Friend Horse used to be up like seven places, but the conversations are not fully what I'm into these days. So I don't spend much time in front of Discord anymore. But I love Alex Trost. He's the man.
00:10:27 - Jenn Junod
Corbin and I just became friends a few weeks ago when we had a Friday night stream that had like 12 people on stream at once.
00:10:36 - Anthony Campolo
Yeah, no, I hopped in for like five minutes on that one. It looks super fun.
00:10:41 - Jenn Junod
I was like, I was coding and everybody else was bullshitting and then I would just Interrupt to ask questions. Oh, my gosh. Big Dougie, you're here.
00:10:49 - Anthony Campolo
Yeah, he probably just popped in to leave a message before he starts his stream.
00:10:53 - Jenn Junod
Yeah. Yay.
00:10:57 - Anthony Campolo
Yeah, I'm trying to get a Secret Sauce episode going with Brian. Have you watched any of his Secret Sauce interviews?
00:11:04 - Jenn Junod
Yes.
00:11:05 - Anthony Campolo
They're really good.
00:11:06 - Jenn Junod
So good. Yeah.
00:11:07 - Anthony Campolo
Have you watched him with Ryan Carniato?
00:11:09 - Jenn Junod
No.
00:11:10 - Anthony Campolo
So watch that. That's probably my favorite one he's done.
00:11:13 - Jenn Junod
Link that one for everybody.
00:11:15 - Anthony Campolo
Yes.
00:11:16 - Jenn Junod
If you have that up. I would say, like, if you. I don't know if anybody else has this, but there's, like, people that make an impact on your life and your career that you don't talk to often. And that would be. Be Dougie.
00:11:29 - Anthony Campolo
Because he has an impact on everyone's career and not everyone has. He doesn't have enough bandwidth to talk to everyone all the time.
00:11:37 - Jenn Junod
It's weird because, like, if I were to be like, hi. I wouldn't know what to say to them.
00:11:45 - Anthony Campolo
Well, just because with people like that, if you have, like, things to do, like, I only message Brian. Like, if there's, like, I want him on my podcast. I think I could be on his podcast. There's, like, a collaboration we can do. Like, I would just, like, yeah, message him in the. Randy. Hey, how's it going, buddy? You know, because, like, he's a busy dude. You know, he doesn't have time for those kind of messages, so. But as long as you can find, like, you've had him on Teach Jenn Tech. So, like, that's a good example of a time you get to collab. And you would be a good guest for the Secret Sauce because he would love to talk to you about your journey through streaming and getting into this stuff. Like, you'll be a great guest for that. So if you're ever in San Francisco, you hit him up and be like, hey, can I get in the Secret Sauce? Like, sure.
00:12:24 - Jenn Junod
That actually reminds me when he was supposed to be on my stream is when I dumped water on my laptop.
00:12:31 - Anthony Campolo
Yeah, I remember that.
00:12:33 - Jenn Junod
I. It was. It was heartbreaking. Yeah.
00:12:38 - Anthony Campolo
But you eventually got him on. I'll drop a link for that one, too.
00:12:41 - Jenn Junod
Yes, yes, he did come on the show. He was so kind. It's. It's one of those people that, like, whenever I get really nervous because I've had to, like, postpone them or, like, life happens, I get, like, more nervous about the stream and then I'm like, oh, yeah, it's not that bad. Okay, cool.
00:13:02 - Anthony Campolo
Are there only six videos showing up on the Teach Jenn Tech YouTube?
00:13:06 - Jenn Junod
Because they're all live streams, I'm slowly going to be downloading them. Downloading them from live streams is confusing.
00:13:12 - Anthony Campolo
I really hate that YouTube does this.
00:13:15 - Jenn Junod
That's a big reason I started doing it where this is only going to Twitch and then I download it and upload it to YouTube. And it actually does better that way than it does with the live streams to YouTube.
00:13:27 - Anthony Campolo
Sorry, say that again. You upload it to where? And to where?
00:13:31 - Jenn Junod
So I stream with Twitch, so it downloads. I can download it from Twitch and then I manually upload it to YouTube.
00:13:38 - Anthony Campolo
So we're not on YouTube right now.
00:13:40 - Jenn Junod
Correct.
00:13:41 - Anthony Campolo
Okay, yeah, that's. I do that the same way with mine. And then sometimes I spend a month putting off uploading the YouTube video like I just did. Oh, here's. Here it is. Okay. I found. You don't have Brian Douglas's name or Open Sauce in the title of this video. It took me forever to find it.
00:14:00 - Jenn Junod
This is why I need to go back through and do them. Also one of the reasons why I'm like, if I download them from a live and move them to that, I can change the dates they were recorded.
00:14:12 - Anthony Campolo
So that's what I'm saying. I actually have a lot of ideas of what you should do with your archive to make it a little simpler to go through and sort.
00:14:18 - Jenn Junod
Ooh, catalog.
00:14:20 - Anthony Campolo
It's like that.
00:14:22 - Jenn Junod
Yes, please send over my way. I also have my websites to do.
00:14:26 - Anthony Campolo
So that's. That's the thing. It will combine with the websites. The website should be the source of truth. So the website. The website should have a page for every single episode, and every single episode should have a page with links to everything that happened, including the video and the repo and description and information about the guest and timestamps. Those are the. Yeah, that's the thing.
00:14:46 - Jenn Junod
There's only like 77 streams and six videos. So there's only like 80. And I think I have roughly the same for my podcast.
00:15:00 - Anthony Campolo
Yeah.
00:15:00 - Jenn Junod
So, you know, that is. That is all on the to do list. Yay. But yes, everybody is streaming right now, which is great. And we will send this after it's uploaded to YouTube. They can watch the recap of how to set up Docker, which should probably start doing. Yeah, we should probably start doing that. Oh, yeah. Yeah, we should. Which.
00:15:27 - Anthony Campolo
So let's talk about Docker. I can tell you my history with Docker because it's fun. Docker is an extremely confusing but useful and now-ubiquitous tool in programming. It took me an extremely long time to figure out how to use it, which is why I wanted to hop on here and walk you through an example that's not incredibly complicated. It won't take you nine hours to figure out, but it took me multiple hours to write this five-minute tutorial that we're going to go through, because the resources for Docker are so awful or just out of date. All we're going to do is create a Node Express server that's going to return a web page with a single H1 on it. That's all it's going to do. Then we're going to containerize that server and run that container on your computer. We're not even going to deploy it anywhere. The main thing this example shows is that you can use Docker in lots of different ways, because you're using Docker Desktop for a database. This is not necessarily what you're going to do with the Postgres stuff, but it's going to give you a better conceptual example of what people mean when they talk about Docker and running their application in Docker or deploying their website with Docker.
00:16:39 - Anthony Campolo
Because when you just run a Postgres database, that's really just for testing purposes. Some people will actually deploy their Postgres databases in a Docker container. And those people are setting themselves up for a bad time in the future because you should not put your database in an ephemeral server that is running in a container that can be wiped out at any time. Some people do it anyway, though. I do it with a bunch of my Railway applications. That's because they're demo apps. But for the most part, if you're running a database, usually run that database on a database server which is not using Docker. What Docker is doing is it's taking that database and it's creating virtual version, self contained version of it that can just run on your computer in a way that makes it simpler to access and to work with than if you're actually running Postgres on your computer. Because you've gone through this whole struggle of trying to download and run Postgres on your local computer, which is something I actually think developers should not do. I think that is not.
00:17:35 - Jenn Junod
Oh yeah, it was just the experience of seeing if I could do it
00:17:38 - Anthony Campolo
and do it to learn how to do it, so you can know why you should never do it again. That's what that exercise is. So what most people do is they'll run it in a Docker container, which is what you're learning to do. Or they'll go one step even further. What I do is deploy a Postgres database on Railway, which is running in a Docker container on Railway. But then it's not running on my machine. It's already over a network. Then if you're going to have weird network errors, you can debug that by working with a live database in production. It's just a live database in production that you can blow away at any point in time. That's mostly what I recommend. But as I was saying, what we're going to do today has nothing to do with any of that. We're just going to run a Node server to figure out what it's like to use Docker to build and deploy a very small application.
00:18:27 - Jenn Junod
And I realize that I probably should have, like, prepped you for these questions.
00:18:34 - Anthony Campolo
You shouldn't have. I'll get better answers if you don't.
00:18:37 - Jenn Junod
Okay, well, then I will ask them when we get to it. So let me. Go ahead. I've already. So once we get done today, y'all, I will have a readme to share. This is something I've been working on doing, and Anthony is a big reason why. And. Oh, I do want. I do want to share this. It's not an official readme. It's very similar, but I had to start doing this so that way I could get help on my Postgres project. So this actually, Which. This will be very easy to put into a Read me. So. So do you share screen. Entire screen. Yay. All right, so this is basically a giant readme because it's.
00:19:34 - Anthony Campolo
But you wrote it in a Google Doc because you hate yourself.
00:19:38 - Jenn Junod
No, because I need other people's feedback and to be able to change it very quickly.
00:19:42 - Anthony Campolo
If only we could collaborate on a readme in a GitHub repo.
00:19:47 - Jenn Junod
Sir. Sir.
00:19:49 - Anthony Campolo
I just hate Google Docs. I understand why lots of people use
00:19:52 - Jenn Junod
it, but it's a lot easier to collaborate. Just this.
00:19:56 - Anthony Campolo
That is, you can leave comments and, you know, gotta open a pr and I understand.
00:20:00 - Jenn Junod
So it was really helpful. And this is why I was, like, so excited. Because, yes, you make fun of me for having to use my tablet to write it down and then upload it.
00:20:09 - Anthony Campolo
I don't make fun of you for that. I'm telling you, you're adding an extra step to your workflow, and that's okay. But if you spend more time practicing typing out your thoughts in a readme, it may be harder now, but you'll get better at it as you do it more. That's all I'm saying. You can do what you want to do and whatever you find easier right now, but you can develop skills by practicing them. That's my point.
00:20:30 - Jenn Junod
I agree with that. And also, people have different learning techniques, and sometimes they do take extra steps, which is annoying. But I was so excited because I
00:20:43 - Anthony Campolo
have an education degree. I'm a teacher. Like, I. I understand that. But I would also still recommend you try multimodal stuff, because even people who excel at a certain kind of learning should do other types of learning that are harder for them because they will learn in a different way, which, in the grand scheme, will be useful. I know, and it feels uncomfortable because people don't want to do that because learning is actually hard.
00:21:05 - Jenn Junod
Learning is hard, but it is fun. And thank you for the follow. Yes, yes, we have a lot to cover today. I see CM Griffin.
00:21:15 - Anthony Campolo
I don't see him. Griffin. I mean, I know he's a streamer. Can't say I know him super well, but appreciate you being here. Thank you.
00:21:21 - Jenn Junod
Yay. It's definitely something that I feel like we are. There's so much that goes into this, and, y'all, if anybody's wondering why I may come across as mean or give Anthony funny faces, you come across
00:21:37 - Anthony Campolo
as confident in your own decisions, and that's a good thing. And you shouldn't apologize.
00:21:44 - Jenn Junod
That's good. Well, I was just gonna tell them like, you're my Internet big brother. That's all I was gonna say, because that's.
00:21:51 - Anthony Campolo
But you shouldn't. You shouldn't apologize for pushing back on my own advice, because that's fine. You should push back, but you should also take it into account.
00:21:58 - Jenn Junod
Thank you. Thank you. I do appreciate that. Okay, so we have the gist up for today of Teach Jenn Docker, and then we have Docker up, which I already downloaded. So we will go through that and see. Griffin, I need to check out your content now. Let me go follow back so I can check out mean streamers. I like mean streamers. That would be fun.
00:22:27 - Anthony Campolo
The meaner, the better.
00:22:30 - Jenn Junod
I mean, I feel like. I don't know. I don't think Theo's mean, but I do say that's why he makes funny content. But I can't say he's mean. I don't know if that's the right.
00:22:45 - Anthony Campolo
He's mean to some people sometimes for reasons that he thinks justify him being mean. And I think more often than not, he's correct. But right now, yeah, he is a little mean. That's because he has a confrontational style.
00:22:59 - Jenn Junod
Oh, that's a good way of saying.
00:23:01 - Anthony Campolo
Yeah, I would say he's confrontational, which some people interpret as mean. So it kind of depends on whether people are used to dealing with confrontational people. I can deal with confrontational people, and I choose not to be confrontational most of the time because there's a certain percentage of people who get very turned off by conflict. And that's why there's a subset of people who extremely dislike Theo. But I think it's fine. You're walking a fine line when you do it.
00:23:29 - Jenn Junod
That is true. That is true. Okay, so we have a to do list, which I am excited about. And for those who also want to know something kind of funny is while I was applying for jobs and having to, like, get help and approval from whatever project I was working on, half the time it was Anthony cleaning up my readmes and restructuring them so they look pretty like this.
00:23:58 - Anthony Campolo
Just polishing them, you know, polishing them, polishing them.
00:24:01 - Jenn Junod
All the content was there. Just making a bit more readable, and I dig it. Ooh, see? C.M. griffin. Same. I am nice mostly, but I don't mind an argument. It's a good. It's good practice, right?
00:24:18 - Anthony Campolo
Because most people are very set in their opinions, and it's good to have them challenged and force you to actually defend them, because then you may find that your opinion is not as firm as you might have thought it was.
00:24:32 - Jenn Junod
Touche. Okay, before we get too far, one thing I have learned since starting Teach Jenn Tech is when there's a to-do list or something like that, I start to glance over the entire thing so I know where I'm going.
00:24:51 - Anthony Campolo
You should. That's why there's an outline at the top.
00:24:53 - Jenn Junod
Yeah. Yeah. Now I'm very excited because it might be in your article. Let's open your article in a new tab. I'm not seeing it here either.
00:25:08 - Anthony Campolo
What were you hoping would be in it?
00:25:10 - Jenn Junod
List of images. Run an image that is close. Create and build a container.
00:25:16 - Anthony Campolo
What are you looking for?
00:25:18 - Jenn Junod
What is a container? Like a definition? What is a container? What is an image and what is a volume?
00:25:25 - Anthony Campolo
Volume will not be in that blog post because I'm not doing anything with volumes, but the other ones are defined once they are first introduced. So for container create, "Build a container" is where the title probably is. That's a good question, actually. I don't know if I give specific definitions of those two terms within this blog post, because the point of this blog post is to explain each of the steps, what they actually are. And by the end you'll understand what an image and a container are. I found that giving the baseline definitions doesn't actually make any sense. But the difference between an image and a container will make sense once you build an image and then run it. You create an image, you build a container, and you run a container. So where an image turns into a container will make more sense once you've done it. That's why I could give you the textbook definition of both those terms right now and they wouldn't mean anything to you. Then we'll go through the exercise and we can kind of go back to them. So let's just do that.
00:26:30 - Anthony Campolo
Define. Actually let's. ChatGPT. This is a good, this is a good use case for ChatGPT. Let's ask ChatGPT to define a docker. What's the difference between a Docker image and a Docker container?
00:26:40 - Jenn Junod
You are such a ChatGPT advocate because
00:26:44 - Anthony Campolo
this is going to give a better answer than any explanation written in the entirety of the Docker docs. I know because I've read the Docker docs and they're trash. So people should use ChatGPT for this.
00:26:55 - Jenn Junod
I will say the docker docs were easier than the Postgres docs.
00:27:01 - Anthony Campolo
Postgres is the only thing that is worse than the docker docs. Postgres. Just installing Postgres is so frickin hard. Not even the docs like installing should be. Before you even need to read the docs. You can't even figure that part out. It's incredible. It's the most important piece of software like ever invented. And it has the worst website ever.
00:27:21 - Jenn Junod
It was tough. It was tough. But that's okay. We move through it and we'll make articles and blogs about it. It'll be good. It'll be good. All right, all right, here we go.
00:27:32 - Anthony Campolo
I'm dropping these in the chat. A Docker image is a lightweight, standalone and executable software package that includes everything needed to run a piece of software, including the code, runtime, system, tools, libraries and settings. So that's a lot of words. It's actually not that complicated of an explanation. It's just a big. Such a big explanation, it almost becomes meaningless. It's technically correct, though.
00:27:56 - Jenn Junod
I feel like where I was getting confused when I set it up was I will ask you after a container.
00:28:07 - Anthony Campolo
So a container is a running instance of a Docker image. So that's why I said running will create an image and then we'll build and run a container. That's what it means right here. A running instance of a Docker image. When you start a Docker image, it creates a container. See, that's great. That's such an awesome way of explaining. I've never heard that explanation before.
00:28:28 - Jenn Junod
That makes sense. The container itself makes sense and running a container makes sense. Going back to the image, one of the where I think is hard for myself, maybe others, was, okay, so when we create a project and it goes on GitHub, it has its own main folder that you go into to be able to make all these changes and things. In my mind, that's what I was comparing an image to. But it's not the same folder structure.
00:29:07 - Anthony Campolo
Yeah, it's close in the sense that the image you can think of as a bunch of code that's going to exist in a GitHub repo. That's what we're going to be creating in this example. But the important part is what is the docker file? The docker file is what explains how to build the image. That's the vast majority of what this tutorial about is about what are the steps of the image itself. The steps are going to be. Is going to take your Node project and do what you do on your computer where you have a package JSON, you install dependencies. Once you have that dependencies, you can run your server and you run your server with a certain command. Those are the steps that are going to be in our Docker image.
00:29:49 - Jenn Junod
Makes enough sense.
00:29:50 - Anthony Campolo
Yeah, a lot of these terms don't make sense until you've already done it. That's why I'm saying we shouldn't get too hung up on definitions right now. We should do the thing and then kind of talk about what happened. Unless you have other questions, which are totally fine. If you have more questions I can talk about.
00:30:08 - Jenn Junod
No, I can't. I can't type at the same time. I can't talk and type. And I just wanted to post your blog.
00:30:16 - Anthony Campolo
Cool. Cool.
00:30:17 - Jenn Junod
Because I will.
00:30:18 - Anthony Campolo
This is a good blog post. This is one that was one of the first that took me a Long time to write and I had to research something I knew absolutely nothing about. And I was able to create a resource for myself that I have continued to use for many years. Tree being a good example. I was learning it because I wanted to figure out how to containerize Redwood because Redwood was talking to all these companies that were running containers and were trying to figure out how to get Redwood to run on a Docker container. I was like, I don't even know how to fricking run a basic node server in a Docker container. I'm not going to be able to figure out how to do it with Redwood. As I was seeing that conversation play out, I created this as a resource for myself and exercise for myself to learn what a fricking Docker container is and how to work with it. And I feel like it's pretty battle tested. I just ran through it today. Even though it's two years old, it still works as expected. So we'll see how it goes with you.
00:31:10 - Jenn Junod
Let's find out. Okay, so we. Yo, how's it going?
00:31:16 - Anthony Campolo
It's got style, Aggie.
00:31:20 - Jenn Junod
I'm not gonna lie. I don't think I ever remember last names. Your last name is super easy and you're just AJC Web Dev. To this day, you are AJC WebDev.
00:31:33 - Anthony Campolo
That's good. Yeah. I don't know if my last name is necessarily that simple. Some people find other ways to pronounce it and based on just looking at it can even be a couple things. Yeah, it's whether it's camp or comp is what people get confused about. Some people say Campolo.
00:31:47 - Jenn Junod
Yes. That is how he taught me.
00:31:49 - Anthony Campolo
Camping in polo. That's right. It's like camping in water polo. Campolo.
00:31:54 - Jenn Junod
Yeah. Well, we got there, we got there and we got. When are. When are you coming on the show? Keep talking about it. Elian. Elian.
00:32:05 - Anthony Campolo
Yeah, I'm not. I'm not sure. So. But I know that they're on the
00:32:08 - Jenn Junod
Astro team when, when you come on the show, you can correct us on how to say your name properly, which I should probably follow up about.
00:32:18 - Anthony Campolo
Yeah.
00:32:19 - Jenn Junod
But hey, we're not working on Astro today for once. Okay. So.
00:32:26 - Anthony Campolo
All right. So the first steps in the create project section are just going to create a folder, initialize a package JSON and then create three files, a JavaScript file, a Docker file, and a docker ignore. The docker ignore being much like. Again, ignore.
00:32:45 - Jenn Junod
Well, because I have to do this in terminal because since I don't have a container yet, I can't do it on Docker. Correct, Correct.
00:32:54 - Anthony Campolo
We're eventually going to run some commands that are going to do stuff that will affect your Docker desktop thing, but that's not until later in the exercise. We're going to start by just creating a regular JavaScript project.
00:33:06 - Jenn Junod
I'm gonna. I was so against this when I first started and I'm like, I'm not even going to try to retype all of these.
00:33:16 - Anthony Campolo
It's just gonna be copy-paste each command and do them individually. That's very important. Oh man, Lunch Dev's Michael Chan's even live right now. Damn, that's funny. I'm gonna get water. I'll be back in just like 15 seconds.
00:33:33 - Jenn Junod
I'm counting. Yes. I love how everyone is streaming today, everyone all at once. How many streams are y'all watching at the same time? Because I know that you want to check in on all of us and make sure we're doing good and support us all. So how many are you watching at once?
00:33:58 - Anthony Campolo
Okay, I'm back.
00:34:09 - Jenn Junod
Yay.
00:34:11 - Anthony Campolo
Okay, pop that. Pop that baby open and then drop that JavaScript code in there. So if you used Express with Ramon on your very first episode. So that's what this is going to be.
00:34:26 - Jenn Junod
What we have to say that I finally got code to work.
00:34:33 - Anthony Campolo
Hey, what's up? You're a senior developer.
00:34:38 - Jenn Junod
This is why. When it installed, it installed in Downloads. Still, for some reason, it did not auto-install to Applications. I had to manually move it to Applications, where most things when they download and you drag and drop to install, they auto-move to Applications.
00:34:58 - Anthony Campolo
They don't auto move it. They usually pop you up with a little window where they have your applications folder right next to it and say drag it from here to there. So they basically stick that step right in front of you so you don't forget it.
00:35:10 - Jenn Junod
Yes. Except, yeah, you don't want aim.
00:35:14 - Anthony Campolo
So it's in your Downloads. Yeah. So check your Downloads folder every day and make sure there's nothing in there from whatever you're doing. This is going to be a source of confusion for the rest of your life.
00:35:27 - Jenn Junod
Yeah, I am much better about checking that now
00:35:32 - Anthony Campolo
if you want a fun story about a thing being in a folder that you didn't know so your whole life was destroyed. I once had a Node Modules folder in my root directory that I didn't know about so that anytime I would download a project, enter it, and then run a dev command Nothing would happen. I was unable to run a dev server on my computer for the first two months of my boot camp because no one could figure out the problem. I wrote everything in a code sandbox and then I would fork the code sandbox into a git repo and then I would deploy the git repo on netlify. I deployed my project every single day to show it to my. To show to my teacher. So I actually learned how to deploy projects like, three months before everyone else because I couldn't run it on my computer. Isn't that incredible?
00:36:23 - Jenn Junod
Is that why you, like, wanted me to use Vercel as, like, my first one? So I could show that thing exactly. Built.
00:36:32 - Anthony Campolo
Exactly.
00:36:34 - Jenn Junod
It didn't make sense until a couple months ago. I had an interview with a company and they were like, "Hey, talk about why you love Astro." By the way, this interview was not with Astro. I compared why people deploy on Netlify or Vercel, just the experience itself, and I was like, I really like Vercel, just the way it works. And thank you, Scott, for the follow. Oh, that's actually what you should come on the show for. No, I feel like Dan should explain. Okay, anyway, I got it. It's showing. Let me go back now.
00:37:30 - Anthony Campolo
So we gotta change that to say, Teach Jenn Docker.
00:37:34 - Jenn Junod
Yeah. Okay, let's get.
00:37:37 - Anthony Campolo
You got. You always got to change something or else it's not a tutorial.
00:37:44 - Jenn Junod
And I actually know what we're doing now because
00:37:49 - Anthony Campolo
you got a port, you got a host, you got a thing and stuff.
00:37:54 - Jenn Junod
And this is like, new. This is, you know, not something that I knew how to do back in the day. I'm so proud.
00:38:04 - Anthony Campolo
Yeah. Cool. So the next part is going to be the actual Docker file. Yeah, look at that. You need to turn and restart your server, because I don't even include nodemon in this example, although apparently Node 18 has a way to do that.
00:38:21 - Jenn Junod
Well, I already restarted the server.
00:38:25 - Anthony Campolo
Right, which you normally have to, because Node itself does not watch for changes. But I think Node 18 might have a way to do that if you pass it the right flag. I don't know how to do that right now, but I'll look that up later. Anyway, let's go to the next steps, where the Docker stuff actually starts.
00:38:40 - Jenn Junod
I should probably install the extension. Install, Install. That was exciting. Thanks for the install. Then we're Going to copy paste.
00:38:56 - Anthony Campolo
Yeah, so let's copy this, the whole thing, and then I'll talk about kind of line by line. There you go. Yeah, that makes sense.
00:39:04 - Jenn Junod
I can say, y'all, in case anybody was curious, if you want to see me struggle with Node versions, especially because we were talking about B Dougie earlier in that episode. I struggled with Node versions. It was interesting, to say the least.
00:39:23 - Anthony Campolo
And this is why Volta. Because Volta makes it really easy to manage your node versions. You should open your window up so we can see the whole thing, all the things.
00:39:34 - Jenn Junod
Okay.
00:39:37 - Anthony Campolo
At least top wise. Yeah, there we go. Okay, so let me just kind of walk through this real quick and then you can ask me questions about individual things. If any of it confuses you. First step defines we're using Node, where it's Node 16 and we're running it in Alpine. Alpine is a Linux operating system. If we left off Alpine, then you would not download the same bundle of things because this is running like it's running Linux and it's running Node. So you can choose to run different kinds of Linux, because different kinds of Linux have different dependencies. This ensures that your Docker file ends up small and lightweight. It's going to be like 100 megabytes instead of 2 gigabytes. That's the only reason why we're using Alpine. Specifically. For someone who's new to Docker, this is totally not that important. But just for the record, for people who are watching this and are confused about what this means, there's your explanation of why we're using Alpine. It's just a way to run Node in a very small Linux operating system.
00:40:43 - Jenn Junod
This also helps because you don't know if you'll get we receive questions from nine months later. Yay.
00:40:52 - Anthony Campolo
Totally. Then workdir. This is the working directory for your project. It spins up a Linux server for you with a file system. That file system is USR src app and the code of our project, which is just a single JavaScript file, is going to be plopped in that working directory.
00:41:17 - Jenn Junod
Cool.
00:41:18 - Anthony Campolo
Then we're copying over the package JSON and the package lock JSON. That's why there's a star after package before the JSON. And that is so when we run this server, it will have the dependencies. What's happening here is what happens every time you run a JavaScript project on your computer. You create a directory. You have a package JSON. That package JSON has some dependencies. You install those dependencies. That pulls a bunch of code onto your computer. Then you can run the project on your computer. First, we copy over the package JSON file. Then we run npm install, a command you've run tons of times. Then after you run the install command, you copy the application code into it. That's why you first copy the package JSON, then run the dependencies, then do another copy step. Then you expose your Node app on a certain port, 8080, and then you say, hey, we're going to run a terminal command. That terminal command is going to contain two blocks, the word node and then index.js, which is what you ran when you were first testing out the thing.
00:42:32 - Anthony Campolo
Basically, this is a way to take the whole process of sticking your current repo and the code in it into some container that will download dependencies and then run the thing. This is the image. This is the image that we're creating that will be built into a container.
00:42:55 - Jenn Junod
It makes enough sense. It does make enough sense.
00:42:58 - Anthony Campolo
That's an explanation that you'll have to go through a couple of times. This is why it took me weeks to write the blog post, because I took each of these steps and had to research the word, figure out what the Docker definition was, explain how that definition maps to this project in particular, and then find the words to actually explain it. So I had to actually write this down step by step, go through it many times, understand what it was conceptually, and then figure out a way to explain that to other people. And it's like, it's not simple, but once you get it, you'll be able to look at something like this and it just like instantly makes sense. Sense. And it's actually an extremely concise way of putting this into like a reproducible
00:43:35 - Jenn Junod
Without you saying what all these were, I would have gotten that it was Node, but I would have had no idea what Alpine was. Yep, working directory, now that I am seeing it. But I would have been like, workdir, I don't know what that is. Yeah, it might have been hit or miss. The copy package JSON, package star JSON, yes. Run npm i, I think I always do npm install, so I don't know if I would have gotten that.
00:44:17 - Anthony Campolo
I I is the short form for install and you could change that to just say install and it would still work.
00:44:22 - Jenn Junod
Works. I'm gonna do that so I remember it. We'll leave it the way it was and then put it in the notes. And then copy, I wouldn't necessarily have known what it was copying.
00:44:48 - Anthony Campolo
Yeah, that's the step that could be a little confusing because you have to think from the perspective of this is a computer you're loading code onto, and then you're installing those dependencies just like you would on your own computer, in which case you have that fat node_modules folder in your project.
00:45:05 - Jenn Junod
Then expose 8080. If it was a different port number, I don't think I would have gotten this because it's 8080. It makes sense to me.
00:45:14 - Anthony Campolo
Classic port
00:45:17 - Jenn Junod
command node and index JS totally makes sense. Save. Yay. Let's put you down.
00:45:26 - Anthony Campolo
And then the next step is your Docker ignore, which is like a git ignore. This is to basically ensure that stuff doesn't end up in your Docker image. That doesn't need to be. It doesn't really need like your git information and the node modules, because basically it will figure out exactly what dependencies you need. This is the step that Johnny should understand. Well, so we don't need to talk about it too much, but it's not going to mess with anything. So just copy, paste that over and let's just go build the image.
00:45:59 - Jenn Junod
Yay. Okay, so we got it saved. Everything set up there.
00:46:07 - Anthony Campolo
Now we got these five Docker commands. These are the only five commands you're going to need to know for an extremely long time. They're going to do everything you need to do. The first one is going to build the image. This is where it's going to go from an image to a built container that can be run. And this is just going to happen inside your computer. You have Docker running right now, and it looks like you're already good. That needs to happen before you can run this next step. If you don't have Docker open and you run this step, it's not going to work and you'll be very confused until you start running your Docker program. That happens to beginners all the time. Very frequently. It happened to me at least five times.
00:46:45 - Jenn Junod
I feel like I'm gonna write that down really quick because, yes, I know you've. You always are like, hey, you probably don't need to write that down for.
00:46:55 - Anthony Campolo
I never say that you should write
00:46:57 - Jenn Junod
down everything because you were like, hey, they may not like need that in the future. If I was writing it for someone else. And that's when I clarified I'm writing it for me, not necessarily for a specific Audience, right?
00:47:10 - Anthony Campolo
Yeah. For the most part, though, you should just write for yourself and assume that there's others like you as your audience. So whatever it was, saying you shouldn't write down was probably fine to write down. It's very hard to include too much information. I've found almost everyone includes not enough information.
00:47:30 - Jenn Junod
Okay. Build and run Docker. Okay, cool. Yay. And so we'll go here. And let's do this.
00:47:47 - Anthony Campolo
I think this is Alexis in the audience with Peachy Lex.
00:47:53 - Jenn Junod
Yes.
00:47:54 - Anthony Campolo
Scott. If it's their first time learning about Docker, it's her first time learning about Docker. So. And this is what you started learning Docker, like two weeks ago, you said.
00:48:05 - Jenn Junod
Yeah, like I knew... well, let me link. The first time I ever looked into Docker, we talked about Kubernetes at the same time and PowerShell. It was intense, but I definitely feel like it was worthwhile because it was a lot of high-level content that made what I'm working on now make more sense.
00:48:39 - Anthony Campolo
And that's why it makes so much more sense to do those after you've already actually run through a tutorial just to get you something working. Because every time you talk about something theoretically ahead of time, it like it won't make sense and then you'll do the exercise and then it'll kind of make sense. But you could have just done the exercise before even worrying about the terms.
00:48:58 - Jenn Junod
Yeah, but
00:49:01 - Anthony Campolo
it depends. Certain topics are worse than others. For Docker in particular, the terms were so confusing and the definitions were so opaque to me that they were completely useless until I had actually done something. You built the thing. And if we stop right now for a second and look in your terminal, you can actually see it ran each individual step: 2 out of 5 working directory, 3 out of 5 copy, 4 out of 5 run. It takes each of those steps and runs them individually. If at some point you tried to install your dependencies and had a package JSON with a misspelled dependency, it would error and say, hey, this broke at this step. If your dependencies were all fine but then you tried to run the server at the end and there's an error in your JavaScript code and it crashes, then it would tell you at that step. Right now, because I gave you working code that's going to work flawlessly, none of that happened. But when you're doing this, you will frequently get errors within individual steps where you need to ask, okay, why did it break on this individual step and how do I fix that?
00:50:06 - Jenn Junod
Fair enough. I feel like just to something that you were just talking about on being new to tech, if you're doing self learning. For myself, it was really helpful to understand theory of Docker and Kubernetes specifically, just because not understanding the big picture really I struggled with understanding why am I doing what I'm doing.
00:50:33 - Anthony Campolo
And so what was the big picture from your point of view?
00:50:38 - Jenn Junod
A lot of it was what is Docker and Kubernetes and why is one used over the other?
00:50:46 - Anthony Campolo
How would you define that right now? I'll be curious.
00:50:50 - Jenn Junod
I know it's not a virtual machine to explain Docker, but it's easier for me to conceptualize it as that because it's like, okay, cool. Like you're going to. You're basically building on a little container in your computer. But it's not just on your computer. It's something that if you put it onto the Docker website in your other
00:51:12 - Anthony Campolo
people could run it. Yeah.
00:51:13 - Jenn Junod
Yes, exactly. Where locally you can't do that. And it's not going to be set up exactly the same way as if you do a GitHub project.
00:51:26 - Anthony Campolo
And then Kubernetes.
00:51:27 - Jenn Junod
How does that relate to Docker Kubernetes? This is the way I explain it in my own head, not necessarily how I think it works for everyone. Kubernetes is like, you could say almost like Docker on steroids, because instead of there being like one container, there's a bunch of containers that are connected to each other that can be set up as all duplicates of each other. Like if one fails, something else will pick it up. Or they can all be different containers. One of the key parts of using containers and Kubernetes is the fact that you can expand your own resources much easier and do more pay per use rather than having to do a virtual server that will just have X amount and you're stuck with it.
00:52:17 - Anthony Campolo
Totally.
00:52:17 - Jenn Junod
Yeah.
00:52:18 - Anthony Campolo
That's a great. You got a good handle on what they are then. Because for me, the big unlock is Kubernetes is a bunch of Docker containers talking to each other for whatever reason you want. Which is understand as important because you need to understand. You really should not even think about Kubernetes until you understand how to just work with a single Docker container. Because what that even is and how it works with other Docker containers in this larger system is going to be extremely confusing until you at least have some handle on what a Docker container is. That's why once I went down this rabbit hole of creating this article, I realized I could spend years learning about just Docker and never touch Kubernetes at all, which is exactly what has happened. I have never used Kubernetes. I tried to install a bunch of Kubernetes tools and figure out Kubernetes, hello world. And it was even 10 times harder than the Docker documentation. And I knew I was not going to be actually working with it anytime soon. So I have still never actually used Kubernetes. But every dev will use Docker probably a lot.
00:53:17 - Anthony Campolo
Certain developers will use Kubernetes at their work for certain specific reasons, but a lot of devs will. There's really no reason to use Kubernetes. And if they're trying to use Kubernetes but they don't need it, then they're going to have an even worse time than someone who does use Kubernetes and actually needs it.
00:53:34 - Jenn Junod
Yeah. Yeah. And it's definitely something that Lex, if you go look at the video that I posted earlier, it is very complex, yet it helped me at least start thinking about things this. And I'm glad my explanation helped so that I'm really happy about that. And I also wrote a blog of some of the things that helped me break it down of like a server, a hard. Like a bare metal server to a virtual machine, to a. I will show you. I have a cool graphic. I was very excited about my graphic and I had to write this for a possible blog for someone else, but they didn't want it and I was like, sweet. I'm gonna keep it. Thank you. Yay, Canva and Josh, I'm so glad you're still here. Yes, we got it deployed. Let me go back. Did I run images yet? I don't think so. Did I? No. Okay, cool.
00:54:47 - Anthony Campolo
Yeah, so run images. What this is going to do is show you the image that you just built and probably a couple others. Open that up wider so you can see it a little clearer.
00:54:58 - Jenn Junod
There we go.
00:54:59 - Anthony Campolo
The one we created is at the very, very top. And you can see actually when each of these, when you created them, it'll tell you when you created them and how large they are.
00:55:08 - Jenn Junod
Which is interesting because
00:55:12 - Anthony Campolo
you already did a Docker tutorial and you already have an Alpine thing.
00:55:16 - Jenn Junod
I was like, but those were some of the defaults they talk you through. But it didn't really make sense to me while I was doing it.
00:55:26 - Anthony Campolo
Hopefully this makes more sense. So what this is going to do now is it's going to run your container and it's going to take port 8080 and pipe it into 49160. So now we're not going to access 8080 anymore. We're going to access a different one. So that's why you have two port numbers here and then you're running it in. There's a dash D there for a flag, which just means you're running it in detached mode. So it's not going to like hang with like a server on it. Your. Your thing is just going to kind of kick off and it'll be running in a background port. So if that doesn't make any sense, you'll see you'll be able to just run the next.
00:56:06 - Jenn Junod
It's actually, I'm thinking about it because with Postgres, we were. Because we were doing it with Docker and they wanted to put PG Admin on. We were running into a lot of port issues.
00:56:22 - Anthony Campolo
So I'm wondering another reason why running Postgres on Railway and grabbing the connection string is great because you don't have to worry about conflicting with ports on your computer.
00:56:31 - Jenn Junod
There we go. Don't know why that came up, but sweet.
00:56:35 - Anthony Campolo
Okay, so now we're going to see the list of actual running containers. You have a long list of images you've already created, but right now there should not be a lot of running containers. We only have one we created. Exactly. It will tell you the name of the image. It'll tell you the command that's being run, which is not the node index command. It's like the Docker entrypoint command, so it's one level abstracted. Most of this information is not super important except for the actual ports and the container ID. You can see the ports it's running on, which I already explained. But we're going to do this, and you're going to grab the container ID that it spit out there and plug it in. Yeah, you got it.
00:57:14 - Jenn Junod
I was trying to copy and paste them out of order. Why don't you ever do that? Feel like it does a lot of really cool things, but.
00:57:22 - Anthony Campolo
So make sure. Get rid. Yeah, get rid of the brackets on the end.
00:57:25 - Jenn Junod
Oh, Great.
00:57:32 - Anthony Campolo
So that's how we know it's running. So now we need.
00:57:35 - Jenn Junod
So could we use the name like Angry L Bacion, however you want to say that. Can we use that instead of the container id?
00:57:51 - Anthony Campolo
Possibly. I'm not sure. Either way, you're gonna. You would have to run a command to look that up. So to me, it doesn't really make a difference.
00:57:58 - Jenn Junod
Well, if it's right there, that's why I'm wondering. Oh,
00:58:08 - Anthony Campolo
look at you go.
00:58:08 - Jenn Junod
That's fun. That's fun. It's also the name.
00:58:12 - Anthony Campolo
Now we should actually open this in a browser so we can see our beautiful website once again. And so it's not 8080, it's 49160.
00:58:23 - Jenn Junod
49160. Yay.
00:58:28 - Anthony Campolo
And it should be the exact same thing. You did it. You're running a Docker container.
00:58:33 - Jenn Junod
Yay. Then something that you have at the very, very end. And I feel like I always forget what does curl do?
00:58:41 - Anthony Campolo
Curl is a way to basically hit a URL and just get the text input that the browser is interpreting. Do it and you'll see what happens. I'm also including the headers as well. It includes the content type and the etag and things like that. And then below that is the HTML the browser is receiving, which is just a single H2 that your Express server is giving you.
00:59:04 - Jenn Junod
Okay. And then so I'm in Docker.
00:59:07 - Anthony Campolo
And then you'll see it there running at the bottom. You should bump up your font on your Docker Desktop. There you go. So you can see it's running right now and you can go inspect it. So click it, see what happens. I don't use Docker Desktop super often, but it'll give you a whole bunch of other information about it.
00:59:24 - Jenn Junod
This is something that I had to learn as a newbie. Looking at this, you can't. It's not the image or the ports, it's the container.
00:59:32 - Anthony Campolo
Yeah.
00:59:32 - Jenn Junod
You actually have to click on the name.
00:59:34 - Anthony Campolo
Yeah.
00:59:35 - Jenn Junod
It's very annoying.
00:59:36 - Anthony Campolo
Totally. So try inspecting it or terminal. Yeah, just go through all of them. Yeah. See what?
00:59:43 - Jenn Junod
Yeah, so you can do commands within it, you can see its files and stats about it.
00:59:49 - Anthony Campolo
There you go.
00:59:51 - Jenn Junod
Pretty cool. I dig it. And I still don't understand the difference between. I get it, but I don't get it. It's going to take me a bit to understand the difference between images and then a project or something. I will get there.
01:00:10 - Anthony Campolo
Image is a squishy word because it's just the code that represents the thing that you're running, which is contained entirely within the Dockerfile and the dockerignore. So the image is like a series of steps that reproduces an artifact. It's going to be different for every project, depending on what your dependencies are and what your Node server does. But once you have it and have the image created, anyone can take that image and run a container based on that image. The image is what takes a long time for one person to create so lots of people can run that image without needing to think about it very much.
01:00:46 - Jenn Junod
Very cool. And then something that's not on here is like the hubs. And the hubs is how it's set up to save to your Docker account.
01:01:00 - Anthony Campolo
Because right now, actually, there are steps after this where I explain how you would publish this onto Docker Hub if you're following. I didn't include those in the gist here because it would have taken a lot longer. We shouldn't do it because it's going to add a whole lot of time.
01:01:13 - Jenn Junod
Yeah, yeah, no, that's.
01:01:14 - Anthony Campolo
That's like a whole separate episode.
01:01:17 - Jenn Junod
Yeah, that's totally fine. I mention it because right now, even though I put this, this is using Docker. It's local only. It's only on my computer.
01:01:26 - Anthony Campolo
It is not actually what I recommend. Before you even do that, though, right now you should do is you should commit this to a git repo and save it.
01:01:35 - Jenn Junod
Well, you know what, y'all, I'm not gonna do it with CLI, because I always forget.
01:01:41 - Anthony Campolo
how to do it. Do you have the GitHub CLI?
01:01:44 - Jenn Junod
Yeah, but look, I can initialize a repo here.
01:01:47 - Anthony Campolo
That's fine, too. Getting it onto the actual GitHub website is the main thing. Wait, actually, sorry, we need to create a gitignore before we do this. Don't do that yet. Don't commit anything. Create a gitignore file, then just put node underscore modules. That's all you need. And DS_Store.
01:02:12 - Jenn Junod
and what?
01:02:13 - Anthony Campolo
Dot, dot. And then all capitalize DS underscore capital S. And then all lowercase after that, the word store. So, sorry, get rid of the extra S. There you go. Yeah, because then otherwise, when other people clone it down to their Apple, they get this stupid DS store thing. It's super, super obnoxious.
01:02:38 - Jenn Junod
New repo Commit. Yes. Publish branch. Okay, that's fine.
01:02:49 - Anthony Campolo
Make it public, not private.
01:02:51 - Jenn Junod
Well, I can go back and change it. Open on GitHub. Oh, this is fun.
01:02:55 - Anthony Campolo
You know, you should make it a public repo, because the whole point of these things is it's a learning exercise for others as well.
01:03:02 - Jenn Junod
I. I wasn't against making it public. I was against not clicking it.
01:03:10 - Anthony Campolo
You're against not clicking the first option? It gives you flexibility without reading the instructions. I know it's a strong urge you have. I understand.
01:03:19 - Jenn Junod
Yes. It is something I do on everything. And I don't even remember how to make it public.
01:03:25 - Anthony Campolo
Yeah. This is why you could never work in crypto.
01:03:28 - Jenn Junod
No.
01:03:29 - Anthony Campolo
You would click the thing and then you would lose all your money and you'd be like, oh, I was supposed to click that thing. Can I have my money back? No.
01:03:37 - Jenn Junod
That is what would happen. Okay. See, we were just really wanting me to learn how to make this public. Maybe pushes change, visibility, change to public. I want to make it public. I have read make it public. Oh.
01:04:05 - Anthony Campolo
This is why I should have done it from the thing in the first place. Unintended consequences.
01:04:14 - Jenn Junod
Okay. Yeah. This is why you don't always clicky clicky. But hey, I remembered my password, so we're good. It is now public and we can do this.
01:04:28 - Anthony Campolo
So do one more thing now add a readme and just copy paste my entire gist.
01:04:33 - Jenn Junod
Oh, my God. I was just about to do that. Yay.
01:04:37 - Anthony Campolo
I was hoping you would do that. Yeah, just go to raw, copy paste that whole sucker. I can fill in my contact details and other stuff later. Yay.
01:04:55 - Jenn Junod
Look at us. We did it. Oh, actually, we can do one more thing. Although I should definitely put alt text with this. I'm almost done. I'm looking up the alt text that I put on other posts so that way I don't have to rewrite it. Whatever, dude. Why is it so hard to see alt text on Twitter? If you open the image, you have to close it and reopen it.
01:05:52 - Anthony Campolo
Yeah, I don't know.
01:05:55 - Jenn Junod
Commit. Hey, it's our faces. That was fun.
01:06:03 - Anthony Campolo
Did the thing.
01:06:04 - Jenn Junod
Yay. Yay. We did the thing. And to take a page out of Scott's book of Please make sure that you follow on Twitch and subscribe on YouTube. Make sure you follow everybody that is currently in the audience right now. You can find me on twitter@jenshaw.com and you can find Anthony at AJC Web Dev. Yay. I mean, like, I. Scott, like, I want to do that. Like, you do such a good job at it. Oh, yay. Enjoy dinner and yes, everyone, thank you for this stream today and coming and hanging out and tomorrow I have a stream during your Twitter space. But y'all, they always have JavaScript jam. Java. Is it Jamsun? Why do I always get I was
01:07:02 - Anthony Campolo
from Jamie, because I also do the FSJam podcast, so it's easy to confuse them. It's just JavaScript Jam. And yeah, you should leave that section saved so you can come hang out and just do your stream before or after. Obviously I'm not saying reschedule the one you have, but for the future, normally.
01:07:21 - Jenn Junod
I don't have streams on Wednesdays. Normally I'm pretty.
01:07:24 - Anthony Campolo
That's even better. You're usually there.
01:07:28 - Jenn Junod
Yeah, but it might get over by then. I don't know.
01:07:33 - Anthony Campolo
Cool.
01:07:34 - Jenn Junod
No, it's like during the end of it, if you guys have a chance,
01:07:39 - Anthony Campolo
just some React Miami talks. Will has his Okta talk on web auth, and [unclear] will be talking about WebPageTest and React performance stuff. We'll talk about that. It'll be fun.
01:07:53 - Jenn Junod
Yay. Well, thank you everybody and oh, let's I can do this. Yay. I'm excited. I will read somebody once I figure out where I actually put my Twitch page, which is always really annoying. I don't know if any other streamers do that. I always like lose where I put Twitch itself.
01:08:16 - Anthony Campolo
Let's see. Who should we raid? My Twitch is not opening right now, but if B Dub is still going, you should definitely raid him.
01:08:24 - Jenn Junod
Yes, he is. Yay. Start raid. Y'all are gonna go watch a great stream. Yay. It's thinking... why does it take so long to raid? I never get it. Well, y'all are ready now. Bye. And yay, they raided.