Transcript from the "Buildah" Lesson
>> We just talked about multi container projects and doing Docker compose and Kubernetes, doing some really cool stuff like that, coordinating containers together. And we're gonna go into one more section, we're gonna leave that entire ecosystem behind. And we're going to talk about something called OCI containers. And OCI stands for open container initiative.
[00:00:21] So these are going to be like non-Docker containers. So we're going to do containers but without Docker. Cuz I want to kind of prove the point to you that Linux containers are not just Docker, Docker's not just Linux containers. And so we're gonna get into this OCI stuff.
[00:00:37] So we're gonna talk about two different technologies that are paired together. One's called Buildah, one's called Podman. So let's go ahead and jump into Buildah. So first of all, these tools only work in Linux. So we are going to be using actually a Docker container that contains Buildah to make all this work, which I know is containers within containers.
[00:00:56] But that's just kind of how that all works. So if you're working with Windows and WSL, everything should just work seamlessly. You shouldn't have to use necessarily the container or anything like that. If you're on Mac OS, you're gonna have to jump into the Buildah container with me.
[00:01:15] So I left a link there if you wanna go check it out. That's just on Docker Hub. So the Buildah container, which is buildah/buildah, has both Buildah and Podman in it, you don't need both. You don't need two different containers. So a lot of the gravity around containers and the container world is centered around Docker, right?
[00:01:42] That was the first to market. It's kind of the centre of gravity there. And in effort to not necessarily be locked into one bender, because we don't want just one cloud provider, or one operating system, or just iPhone or just Mac, it's a good idea to have a competitive marketplace of ideas.
[00:02:06] And so that's when the open container initiative kind of came to fruition. So it is a product underneath the Linux Foundation. So there's a lot of support behind it. And it's a good thing to keep in mind that Docker is a part of OCI. So this is not like Docker versus OCI, right?
[00:02:23] They're both competing together and helping each other, it's a very collaborative environment. So it's great. And the other thing is that you can build containers with Docker and execute them with Podman and Buildah. And visa versa, you can build them with Buildah and Podman and execute them with Docker.
[00:02:42] So these tools interrelate and they're compatible with each other in that particular way. So it encourages a healthy diversity of players in the market. Everybody wins here. So Buildah and Podman are not the only projects, I'll talk about a couple more at the end. These are just the two that have the most steam, that are kind of rolling forward that I wanted to get in front of you.
[00:03:08] And so it's kind of strange that we're taking Docker and we're splitting it into two different products here, Buildah and Podman. But in reality, Docker is actually split the same way, you just don't actually really realize it. So Docker, there's actually Docker, which is the client. Which does the building and things like that.
[00:03:24] And there's a different thing running in the background called Dockerd, which stands for Docker daemon, which is actually what's executing the code for you, or executing the containers for you. And so when you say docker run something, it sends that to the docker daemon in the background and it's running that stuff for you via the Docker daemon.
[00:03:43] So even though you didn't know that that was there, that's actually what's happening. And that's kind of how this is split with Buildah and Podman. Buildah is going to build the containers for you and then Podman is going to be the one that's actually executing it for you.
[00:03:54] The advantage of Podman over Dockerd is it's actually not running as a daemon in the background, it's actually just executes it and that kind of gets out of the way. So let's get started with Buildah. So the funny thing about how Buildah was named, it's named how you would say builder with a Boston accent.
[00:04:13] Because apparently one of the core maintainers of this project was from Boston and he always called a buildah. Which I'm not doing a very good impression of it, because I'm not from Boston. But I thought that was very funny. So you can follow the instructions to download and execute and all that kind of stuff here if you want to.
[00:04:29] I'm just gonna use it direct from the container, feel free to do the same with me. If you are going to install it, which I did do within my WSL computer here, you will very likely need to put here at this registry.com. You will probably need to put this, which I pasted in there.
[00:04:47] Again, I am going to be using the container, so I'm not going to do anything like that, but you might need this. And you're also gonna have to make sure you have this thing called runc, which is another project, again, from this open container initiative project. And runc is just say, hey, take this container and do something with it, right?
[00:05:08] Execute it in some fashion, that's what runc is. Runc underpins Buildah and Podman. All right, so let's go ahead and run Buildah, or the container. So I'm gonna run this in my environment. And this will run the Buildah container and it will mount in your current directory, wherever you are.
[00:05:37] So I'm gonna come over here to this. Let's do the more-complicated, cd, oops, ../more-complicated-node app. This is something we did with, Yeah, this is great, perfect. So we'll do this one. So I'm gonna run that Docker command right there. Again, if you're gonna do this via Docker, do it this way.
[00:06:11] If you're not gonna do it via Docker, you don't need to run this. So this is going to mount in this directory right there, source. Okay, so now I'm inside of a container, which is going to be running. Let's check, I don't even know. etc/issue. And I'm pretty sure that this is Red Hat.
[00:06:41] So let's go with that, I think this is Red Hat Linux. Okay, and so now I have access to Buildah. Version, there you go. Cool? It's a tool written in Go, in case you were curious.