How to live without Docker for developers - Part 2 | Native approach to build an image with Buildah

January 13, 2021

As you might already know, Kubernetes is going to drop support for Docker. Starting from version 1.20 that was recently released in December 2020 you will see a deprecation warning for Docker. Docker runtime support will be completely removed from Kubernetes in version 1.22 that will be release in late 2021. After that you will need to switch to one of the other compliant container runtimes, like containerd or CRI-O inside your clusters. Despite both containerd and CRI-O know how to pull docker images and run them and Docker Images Manifest V2 and OCI image specification are almost the same, nobody knows how long Docker images will be supported.

As developers, we need to be prepared to build either docker or OCI images in just a one click and get used to living without Docker.

Therefore I decided to create a series of videos with the common title - How to live without Docker for developers.

In the first episode I showed you how you can easily build an image using Buildah if you already have a Dockerfile. But what to do if you don’t have it? Do you need to create one? Of course - not!

In the second episode I will show you the native approach to build an image from scratch using Buildah commands. As a result, you don't need to create a Dockerfile for your application anymore.

Please check it out and subscribe to my channel to be notified when my new videos will be published.

Thank you in advance.

Link to the video: https://youtu.be/CLhzNZ9ZavQ

Recommended content

Comments

  • Reden

    September 15, 2023

    Hi sir, first is I am thankful of your videos learning about Buildah and Podman. But I am a beginner, I tried to create a script using buildah native approach but I encountered a problem when running the script at around that it will run the npm command (i am using wsl2 ubuntu 22.04). Below are my Docker script and the Native Buildah script (for completion, need your help sir) # Define node version FROM node:18.17.1-alpine as build # Define container directory WORKDIR /usr/src/app # Copy package*.json for npm install COPY package*.json ./ # Run npm clean install, including dev dependencies for @angular-devkit RUN npm ci # Run npm install @angular/cli RUN npm install -g @angular/cli # Copy all files COPY . . # # without using NGINX # EXPOSE 4200 # CMD [ "ng", "serve", "--host", "0.0.0.0" ] # Run ng build through npm to create dist folder RUN npm run build --prod # Define nginx for front-end server FROM docker.io/library/nginx:alpine # Copy dist from ng build to nginx html folder COPY --from=build /usr/src/app/dist/pharis /usr/share/nginx/html -------- #!/bin/bash echo "create a build container" buildcon=$(buildah from docker.io/library/node:18.17.1-alpine) buildah config --workingdir /usr/src/app $buildcon buildah copy $buildcon ./package*.json ./ buildah run $buildcon npm ci buildah run $buildcon npm install -g @angular/cli buildah copy $buildcon ./src ./ buildah copy $buildcon ./*.json ./ buildah run $buildcon npm run build --prod buildcon_mount=$(buildah mount $buildcon) echo $buildcon_mount


  • Reden

    September 15, 2023

    Here is the result when I run the bash file sir... create a build container ba336389bbf2ca180040edf5a55ea8b8f1c6a354e0a7a843721e32237b57510b 2023-09-15T03:15:50.000746957Z: creating cgroup directory `/sys/fs/cgroup/net_cls,net_prio/buildah-buildah1688411599`: No such file or directory error running container: error from crun creating container for [/usr/local/bin/npm ci]: : exit status 1 error while running runtime: exit status 1 2023-09-15T03:15:50.000969691Z: creating cgroup directory `/sys/fs/cgroup/net_cls,net_prio/buildah-buildah2869675797`: No such file or directory error running container: error from crun creating container for [/usr/local/bin/npm install -g @angular/cli]: : exit status 1 error while running runtime: exit status 1 b3c9eae04aad9f272fcccf9b4810d7af7b9a094fe601fca7016729aee3472fa5 fc738dbee738029dfe3e25c454781cffbf41da6380781b0feb21cbc903fb94d8 2023-09-15T03:15:51.000687840Z: creating cgroup directory `/sys/fs/cgroup/net_cls,net_prio/buildah-buildah1015743529`: No such file or directory error running container: error from crun creating container for [/usr/local/bin/npm run build --prod]: : exit status 1 error while running runtime: exit status 1 /var/lib/containers/storage/overlay/38a409d7527ace350c8eb60060153d26407d801007e0cf1cbbf45a2b1667f3ca/merged


  • Reden

    September 15, 2023

    I was able to run it now without error! I run it as non-root user....


  • Andrew Malkov

    November 06, 2023

    2 Reden: I'm glad that you were able to fix it. Good job!


Leave your comment