Skip to content

Commit

Permalink
seo
Browse files Browse the repository at this point in the history
  • Loading branch information
btholt committed Apr 25, 2024
1 parent 95163e5 commit a8e31ff
Show file tree
Hide file tree
Showing 32 changed files with 377 additions and 10 deletions.
15 changes: 13 additions & 2 deletions lessons/01-welcome/A-introduction.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
---
description:
description: >-
Complete Intro to Containers course by Brian Holt aims to demystify
containers, making them accessible to developers regardless of expertise level
in JavaScript. The course covers Linux basics, usage on macOS and Windows,
emphasizing the importance of containers in modern tech environments.
keywords:
- containers
- intro
- developers
- Linux basics
- macOS
- Windows
- Brian Holt
---

## Course Objective
Expand Down Expand Up @@ -54,4 +65,4 @@ And hey, if you could take a second and [star the repo on GitHub][gh] I'd be sup
[issue]: https://github.com/btholt/complete-intro-to-containers-v2/issues
[project-files]: https://github.com/btholt/projects-for-complete-intro-to-containers-v2
[linux]: https://frontendmasters.com/courses/linux-command-line/
[sqlitecloud]: https://sqlitecloud.io/
[sqlitecloud]: https://sqlitecloud.io/
13 changes: 11 additions & 2 deletions lessons/01-welcome/B-set-up.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
---
description:
description: >-
Learn about Docker Desktop, a convenient desktop app GUI to control Docker on
your computer. Follow installation instructions for Windows, macOS, and Linux
provided in the document. Understand system requirements, internet usage, and
tools used in the course.
keywords:
- Docker Desktop
- installation instructions
- system requirements
- internet usage
- tools FAQ
---

## Docker Desktop
Expand Down Expand Up @@ -63,4 +72,4 @@ The longer answer is that it's likely _most_ of the course would work on somethi
[vscode-icons]: https://marketplace.visualstudio.com/items?itemName=vscode-icons-team.vscode-icons
[dracula]: https://draculatheme.com/terminal
[starship]: https://starship.rs/
[nerd]: https://www.nerdfonts.com/font-downloads
[nerd]: https://www.nerdfonts.com/font-downloads
14 changes: 14 additions & 0 deletions lessons/02-crafting-containers-by-hand/A-what-are-containers.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
---
description: >-
Understand the simplicity of containers by exploring how they leverage a few
Linux kernel features for isolation, contrasting with managing bare metal
servers or virtual machines. Discover the advantages and trade-offs associated
with each approach, leading to the emergence of containers as a cost-effective
and efficient solution for deploying code.
keywords:
- containers
- Linux kernel features
- bare metal servers
- virtual machines
- resource management
- security
- deploying code
---

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.
Expand Down
14 changes: 13 additions & 1 deletion lessons/02-crafting-containers-by-hand/B-chroot.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
---
title: "chroot"
title: chroot
description: >-
Learn how to use the Linux `chroot` command within containers to set a new
root directory, isolating processes for enhanced security. Follow a
step-by-step guide to create a new environment, copy necessary libraries, and
successfully run commands within the isolated space.
keywords:
- Linux chroot command
- container security
- isolating processes
- copying libraries in chroot
- Ubuntu Docker container
- setting new root directory
---

I've heard people call this "cha-root" and "change root". I'm going to stick to "change root" because I feel less ridiculous saying that. It's a Linux command that allows you to set the root directory of a new process. In our container use case, we just set the root directory to be where-ever the new container's new root directory should be. And now the new container group of processes can't see anything outside of it, eliminating our security problem because the new process has no visibility outside of its new root.
Expand Down
13 changes: 13 additions & 0 deletions lessons/02-crafting-containers-by-hand/C-namespaces.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
---
description: >-
Understand the importance of namespaces and cgroups for security and resource
management in server environments. Learn how namespaces can isolate processes
to enhance security and prevent unauthorized access in shared server
environments, beyond what chroot alone provides.
keywords:
- namespaces
- cgroups
- security
- resource management
- chroot
- process isolation
- server environment
---

While chroot is a pretty straightforward, namespaces and cgroups are a bit more nebulous to understand but no less important. Both of these next two features are for security and resource management.
Expand Down
10 changes: 10 additions & 0 deletions lessons/02-crafting-containers-by-hand/D-cgroups.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
---
title: cgroups
description: >-
In the Frontend Masters course "Complete Intro to Containers" taught by Brian Holt, participants learn how to manage server resources on high-traffic shopping days like Black Friday. The course introduces cgroups, a technology developed by Google, which safeguards sites from crashes by limiting resource usage per process, ensuring stability and preventing malicious overloads. This essential tool enhances server efficiency and security in shared environments, enabling robust e-commerce operations.
keywords:
- Frontend Masters Containers
- Brian Holt Containers Course
- cgroups technology
- server resource management
- prevent server crashes
- e-commerce server stability
- Google cgroups implementation
---

Okay, so now we've hidden the processes from Eve so Bob and Alice can engage in commerce in privacy and peace. So we're all good, right? They can no longer mess each other, right? Not quite. We're almost there.
Expand Down
14 changes: 14 additions & 0 deletions lessons/03-docker/A-docker-images.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
---
description: >-
Learn how to work with Docker images without Docker by unpacking, exporting,
and creating a new isolated environment manually through commands. Understand
the core concepts behind Docker such as namespace isolation, cgroups
limitation, and chroot environment while exploring functionalities like
networking and volumes.
keywords:
- Docker images
- Docker Hub
- container environment
- namespace isolation
- cgroups
- chroot
- environment setup
---

These pre-made containers are called _images_. They basically dump out the state of the container, package that up, and store it so you can use it later. So let's go nab one of these image and run it! We're going to do it first without Docker to show you that you actually already knows what's going on.
Expand Down
12 changes: 12 additions & 0 deletions lessons/03-docker/B-docker-images-with-docker.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
---
description: >-
Learn how to use Docker to run and interact with container images like Alpine
and Ubuntu, execute commands within containers, manage running containers in
the background, and clean up containers efficiently.
keywords:
- Docker
- container images
- Alpine
- Ubuntu
- running containers
- manage containers
- clean up containers
---

### Docker Images with Docker
Expand Down
12 changes: 12 additions & 0 deletions lessons/03-docker/C-javascript-on-docker.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
---
description: >-
Learn how to run Node.js, Deno, Bun, and other runtimes in containers using
Docker images. Explore different Linux distros like Debian, Alpine, and CoreOS
for your containerized applications.
keywords:
- Node.js
- Docker
- containers
- Linux distros
- Deno
- Bun
- runtimes
---

## Node.js on Containers
Expand Down
14 changes: 14 additions & 0 deletions lessons/03-docker/D-tags.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
---
description: >-
Learn how to manage Docker container versions, from using the latest tag to
specifying specific versions for Node.js and exploring Alpine Linux for
minimalistic container deployments. Discover the benefits of choosing
lightweight Alpine containers over larger Ubuntu or Debian images for faster
deployment, reduced storage costs, and enhanced security.
keywords:
- Docker containers
- version management
- Alpine Linux
- Node.js
- container deployment
- security
- minimalist containers
---

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
Expand Down
12 changes: 11 additions & 1 deletion lessons/03-docker/E-docker-cli.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
---
title: "Docker CLI"
title: Docker CLI
description: >-
Explore Docker CLI features like pull, push, inspect, and more. Learn how to
manage containers efficiently with commands such as pause, unpause, exec,
import, export, history, info, top, rm, rmi, logs, restart, and search.
keywords:
- Docker CLI
- container management
- Docker commands
- Docker features
- Docker container operations
---

Let's take a look at some more cool features of the Docker CLI.
Expand Down
12 changes: 12 additions & 0 deletions lessons/04-dockerfiles/A-intro-to-dockerfiles.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
---
description: >-
Learn how to build Docker containers with a Dockerfile, the key instructions
involved, and the concept of disposable containers. Discover the power of
creating container images incrementally by leveraging existing images in the
Docker ecosystem.
keywords:
- Docker containers
- Dockerfile
- building containers
- disposable containers
- docker run command
- container versioning
---

So far we've been focusing a lot on running containers and haven't much dug into building them. This is on purpose because most of benefit of containers for developers comes from the running of containers. If you learn one thing, it should be how to run them. In fact I'll event venture to say that _most_ developers really only ever need to know how to run them. But you, you're going to learn how to write them. It's an extra superpower.
Expand Down
15 changes: 14 additions & 1 deletion lessons/04-dockerfiles/B-build-a-nodejs-app.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
---
title: "Build a Node.js App"
title: Build a Node.js App
description: >-
Learn how to set up a basic Node.js application inside Docker with detailed
steps on copying files, exposing ports, and user permissions. Enhance your
Dockerfile skills by optimizing file structures and using instructions like
COPY, USER, and WORKDIR effectively.
keywords:
- Dockerfile
- Node.js application
- Docker setup
- copy files in Docker
- expose ports in Docker
- user permissions in Docker
- WORKDIR instruction
---

So now let's dig into some more advance things you can do with a Dockerfile. Let's first make our project a real Node.js application. Make a file called `index.js` and put this in there.
Expand Down
14 changes: 13 additions & 1 deletion lessons/04-dockerfiles/C-build-a-more-complicated-nodejs-app.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
---
title: "Build a More Complicated Node.js App"
title: Build a More Complicated Node.js App
description: >-
Learn how to containerize a Node.js app using Fastify, npm, and Docker. Follow
steps for npm installation, Dockerfile creation, and handling permissions
issues within the container.
keywords:
- Node.js
- Fastify
- npm install
- Docker
- containerize
- Dockerfile
- permissions issues
---

Okay, all looking good so far. Let's make this app go one step further. Let's have it have an npm install step! In the directory where your app is, put this:
Expand Down
9 changes: 9 additions & 0 deletions lessons/04-dockerfiles/D-a-note-on-expose.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
---
description: >-
Understanding the usage and limitations of the `EXPOSE` instruction in Docker,
its intended purpose to expose container ports to the host machine, and the
optional `-P` flag for mapping ports to random host ports. Considerations
include documentation benefits and deliberate port mapping.
keywords:
- Docker EXPOSE instruction
- Docker port mapping
- Dockerfile port documentation
---

This was a point of confusion for me so I'm going to try to clear it up for you. There is an instruction called `EXPOSE <port number>` that its intended use is to expose ports from within the container to the host machine. However if we don't do the `-p 3000:3000` it still isn't exposed so in reality this instruction doesn't do much. You don't need `EXPOSE`.
Expand Down
10 changes: 10 additions & 0 deletions lessons/04-dockerfiles/E-layers.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
---
description: >-
Learn how Docker optimizes build processes by reusing cached layers and
rebuilding only what has changed, like with the COPY instruction. Discover
strategies to speed up container-building, such as breaking COPY into multiple
instructions for efficient npm ci runs in Node.js applications.
keywords:
- Docker optimization
- container building
- npm ci optimization
- speed up Docker builds
---

Go make any change to your Node.js app. Now re-run your build process. Docker is smart enough to see the your `FROM`, `RUN`, and `WORKDIR` instructions haven't changed and wouldn't change if you ran them again so it uses the same layers it cached from the previous but it can see that your `COPY` is different since files changed between last time and this time, so it begins the build process there and re-runs all instructions after that. Pretty smart, right? This is the same mechanism that Docker uses when you pull a new container to download it in pieces. Each one of those corresponds to a layer.
Expand Down
11 changes: 11 additions & 0 deletions lessons/05-making-tiny-containers/A-alpine-linux.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
---
description: >-
Learn how to make your Node.js app container faster, cheaper, and more secure
by optimizing its size. Reduce vulnerabilities and hosting costs with tips on
minimizing container size using Alpine Linux in Docker.
keywords:
- Node.js
- container optimization
- Alpine Linux
- Docker
- security
- cost-effective hosting
---

We've now built a nice little container for our Node.js app and we absolutely could ship it as-is to production. However there's a few things we can do to make things even faster, cheaper, and more secure.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
---
title: "Making Our Own Alpine Node.js Container"
title: Making Our Own Alpine Node.js Container
description: >-
Learn how to create a custom Node.js Alpine container by installing system
dependencies and setting up a minimal Linux container with Node.js and npm.
Explore steps to optimize the container size and user setup, mirroring
practices from official containers.
keywords:
- Node.js Alpine container
- Dockerfile tutorial
- system dependencies installation
- Alpine Linux setup
- custom container optimization
---

## Making our own Node.js Alpine container
Expand Down
9 changes: 9 additions & 0 deletions lessons/05-making-tiny-containers/C-multi-stage-builds.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
---
description: >-
Learn how to optimize Docker images using multistage builds with Node.js and
Alpine, reducing container size significantly by eliminating unnecessary
dependencies like npm. Follow a tutorial on building a Dockerfile with
multiple stages and leveraging Alpine for smaller, more efficient containers.
keywords:
- Docker multistage build
- Node.js Alpine Docker image
- optimize Docker image size
---

Hey, we're already half-way to ridiculous, let's make our image EVEN SMALLER. Technically we only need `npm` to build our app, right? We don't actually need it to run our app. Docker allows you to have what it called multistage builds, we it uses one container to build your app and another to run it. This can be useful if you have big dependencies to build your app but you don't need those dependencies to actually run the app. A C++ or Rust app might be a good example of that: they need big tool chains to compile the apps but the resulting binaries are smaller and don't need those tools to actually run them. Or one perhaps more applicable to you is that you don't need the TypeScript or Sass compiler in production, just the compiled files. We'll actually do that here in a sec, but let's start here with eliminating `npm`.
Expand Down
12 changes: 12 additions & 0 deletions lessons/05-making-tiny-containers/D-distroless.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
---
description: >-
Learn about the differences between Alpine and Distroless for Docker
containers, focusing on edge cases with Alpine and the stripped-down nature of
Distroless. Explore alternative options like Wolfi, Red Hat's Universal Base
Image Micro, and Google's Distroless projects, emphasizing security and
minimalism.
keywords:
- Alpine
- Distroless
- Docker containers
- security
- minimalism
---

You may not want to use Alpine. [This blog post goes into depth][blog] but let me sum it up with two points:
Expand Down
13 changes: 13 additions & 0 deletions lessons/05-making-tiny-containers/E-static-asset-project.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
---
description: >-
Learn how to build a front end website using Astro, React, TypeScript, and
Tailwind with step-by-step instructions. Create a multi-stage Dockerfile to
build and serve the project with NGINX, simplifying static file serving for
your users.
keywords:
- Astro
- React
- TypeScript
- Tailwind
- Dockerfile
- NGINX
- static assets
---

We're going to do a project now! Feel free to attempt the project first and then follow along with me as I code the answer.
Expand Down
13 changes: 13 additions & 0 deletions lessons/06-docker-features/A-bind-mounts.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
---
description: >-
Learn about using volumes and bind mounts in Docker containers to handle
stateful operations, along with the differences between them. Bind mounts
enable flexible file access between the host computer and container, offering
a practical solution for testing or development scenarios.
keywords:
- Docker
- volumes
- bind mounts
- stateful containers
- containerization
- NGINX
- Dockerfile
---

So far we've been dealing with self-contained containers. Normally this is all you ever want: containers that can spin up and spin down as frequently as they need to. They're ephemeral, temporary, and disposable. None of these containers are "snowflakes". When I say snowflakes, picture you're running a server that's serving a Wordpress site. Imagine setting up this server, SSH'ing into the server, and setting everything up to be just right and tuned to the exact way you need it. This would be a snowflake server: if someone goes and deletes this server, you're screwed. You have to go and spend a bunch of time re-setting up this server. This is exactly the sort of thing we're trying to avoid with containers. These are the "pet" containers we talked about earlier. We want to make our servers easy to reproduce whenever we want so we can spin up and spin down servers at will. These are the "cattle" containers we talked about.
Expand Down
Loading

0 comments on commit a8e31ff

Please sign in to comment.