diff --git a/lessons/02-crafting-containers-by-hand/A-what-are-containers.md b/lessons/02-crafting-containers-by-hand/A-what-are-containers.md index e6b90ba..3b63d0f 100644 --- a/lessons/02-crafting-containers-by-hand/A-what-are-containers.md +++ b/lessons/02-crafting-containers-by-hand/A-what-are-containers.md @@ -3,7 +3,7 @@ Containers are probably simpler than you think they are. Before I took a deep dive into what they are, I was very intimidated by the concept of what containers were. I thought they were for one super-versed in Linux and sysadmin type activties. In reality, the core of what containers are is just a few features of the Linux kernel duct-taped together. Honestly, there's no single concept of a "container": it's just using a few features of Linux together to achieve isolation. That's it. -So how comfortable are you with the command line? This course doesn't assume wizardry with bash or zsh but this probably shouldn't be your first adventure with it. If it is, [check out my course on the command line and Linux][cli]. This course will give you more than we'll need to keep up with this course. +So how comfortable are you with the command line? This course doesn't assume wizardry with bash or zsh but this probably shouldn't be your first adventure with it. If it is, [check out my course on the command line and Linux][linux]. This course will give you more than we'll need to keep up with this course. ## Why Containers diff --git a/lessons/02-crafting-containers-by-hand/C-namespaces.md b/lessons/02-crafting-containers-by-hand/C-namespaces.md index 8abb7d2..3816e4e 100644 --- a/lessons/02-crafting-containers-by-hand/C-namespaces.md +++ b/lessons/02-crafting-containers-by-hand/C-namespaces.md @@ -27,8 +27,9 @@ So let's create a chroot'd environment now that's isolated using namespaces usin **NOTE**: This next command downloads about 150MB and takes at least a few minutes to run. Unlike Docker images, this will redownload it _every_ time you run it and does no caching. -``bash -exit # from our chroot'd environment if you're still running it, if not skip this +````bash +# from our chroot'd environment if you're still running it, if not skip this +exit ## Install debootstrap @@ -43,7 +44,7 @@ unshare --mount --uts --ipc --net --pid --fork --user --map-root-user chroot /be mount -t proc none /proc # process namespace mount -t sysfs none /sys # filesystem mount -t tmpfs none /tmp # filesystem -``` +```` This will create a new environment that's isolated on the system with its own PIDs, mounts (like storage and volumes), and network stack. Now we can't see any of the processes! diff --git a/lessons/03-docker/B-docker-images-with-docker.md b/lessons/03-docker/B-docker-images-with-docker.md index 20495a4..837d1fc 100644 --- a/lessons/03-docker/B-docker-images-with-docker.md +++ b/lessons/03-docker/B-docker-images-with-docker.md @@ -64,7 +64,7 @@ Now you can refer to these by a name you set. But now if you tried it again, it' In the future you can just do ```bash -docker run --rm -dit --name my-ubuntu ubuntu:bionic +docker run --rm -dit --name my-ubuntu ubuntu:jammy docker kill my-ubuntu ``` diff --git a/lessons/03-docker/D-tags.md b/lessons/03-docker/D-tags.md index 92f21a5..c20b18d 100644 --- a/lessons/03-docker/D-tags.md +++ b/lessons/03-docker/D-tags.md @@ -4,10 +4,10 @@ So far we've just been running containers with random tags that I chose. If you run `docker run -it node` the tag implicitly is using the `latest` tag. When you say `docker run -it node`, it's the same as saying `docker run -it node:latest`. The `:latest` is the tag. This allows you to run different versions of the same container, just like you can install React version 17 or React version 18: some times you don't want the latest. Let's say you have a legacy application at your job and it depends on running on Node.js 12 (update your app, Node.js is already past end-of-life) then you can say ```bash -docker run -it node:12 bash +docker run -it node:20 bash ``` -Once in the shell, run `node --version` and you'll see the Node.js version is 12._._! Neat! This is helpful because now we can fix our Node.js version to the one our app expects. Hop back over to [the Docker Hub page for the node container][node]. Take a look at all the version of the node container you can download. Let's try another one. +Once in the shell, run `node --version` and you'll see the Node.js version is 20._._! Neat! This is helpful because now we can fix our Node.js version to the one our app expects. Hop back over to [the Docker Hub page for the node container][node]. Take a look at all the version of the node container you can download. Let's try another one. ```bash docker run node:20-alpine cat /etc/issue diff --git a/lessons/04-dockerfiles/C-build-a-more-complicated-nodejs-app.md b/lessons/04-dockerfiles/C-build-a-more-complicated-nodejs-app.md index 8deac2d..55cc8c8 100644 --- a/lessons/04-dockerfiles/C-build-a-more-complicated-nodejs-app.md +++ b/lessons/04-dockerfiles/C-build-a-more-complicated-nodejs-app.md @@ -100,7 +100,7 @@ Now try building and running your container. It should work now! Yay! > **NOTE:** Make sure you don't bind your app to host `localhost` (like if you put `localhost` instead of `0.0.0.0` in the host in our Fastify app.) This will make it so the app is only available _inside_ the container. If you see `connection reset` instead of when you're expecting a response, this a good candidate for what's happening (because this definitely didn't _just_ happen to me 😂.) -[node-file]: https://github.com/btholt/project-files-for-complete-intro-to-containers-v2/blob/main/build-a-more-complicated-nodejs-app/main.js -[node-file]: https://github.com/btholt/project-files-for-complete-intro-to-containers-v2/blob/main/build-a-more-complicated-nodejs-app/package.json +[node-file]: https://github.com/btholt/project-files-for-complete-intro-to-containers-v2/blob/main/build-a-more-complicated-nodejs-app/index.js +[package-file]: https://github.com/btholt/project-files-for-complete-intro-to-containers-v2/blob/main/build-a-more-complicated-nodejs-app/package.json [dockerfile-file]: https://github.com/btholt/project-files-for-complete-intro-to-containers-v2/blob/main/build-a-more-complicated-nodejs-app/Dockerfile [fastify]: https://fastify.dev/ diff --git a/lessons/05-making-tiny-containers/B-making-our-own-alpine-nodejs-container.md b/lessons/05-making-tiny-containers/B-making-our-own-alpine-nodejs-container.md index 512840c..3a577c7 100644 --- a/lessons/05-making-tiny-containers/B-making-our-own-alpine-nodejs-container.md +++ b/lessons/05-making-tiny-containers/B-making-our-own-alpine-nodejs-container.md @@ -82,6 +82,6 @@ CMD ["node", "index.js"] [⛓️ Link to the Dockerfile][dockerfile-file] -It works! We're down to 89MB (compared to 150MB-ish with the official `node:12-alpine` container). Honestly, I'm not entirely sure what we cut out from the other `node:20-alpine` container but it's probably important. Again, I'd stick to the official containers where they exist. But hey, we learned how to add a user and install system dependencies! Let's make it even small because why the hell not. +It works! We're down to 89MB (compared to 150MB-ish with the official `node:20-alpine` container). Honestly, I'm not entirely sure what we cut out from the other `node:20-alpine` container but it's probably important. Again, I'd stick to the official containers where they exist. But hey, we learned how to add a user and install system dependencies! Let's make it even small because why the hell not. -[dockerfile-file]: https://github.com/btholt/project-files-for-complete-intro-to-containers-v2/blob/main/making-our-own-alpine-nodejs-container/Dockerfile +[dockerfile-file]: https://github.com/btholt/project-files-for-complete-intro-to-containers-v2/blob/main/make-our-own-alpine-nodejs-container/Dockerfile