When it comes to being a traditional network engineer, we often have a “go it alone” mindset. This is due to the nature of working in operations. Normally we are given a task or a series of projects that we must complete solo. This is because our teammates are just as loaded with work as we are. Although, this does not mean we can’t ask for help.
The DevOps way is a completely different shift in mindset. Collaboration is the norm, and it is highly encouraged. Which leads me to explain how this post came together.
Containerize to collaborate
Recently, I have been building several python applications. This always seems to result in me having to face one problem… “Once the app is built, how should I run it?” The easy answer would be to run it on my local system. But this does not work for several reasons. I could also build a virtual machine and host it there. But that would use more resources than my app requires. Plus, building a vm means that it must be maintained and supported.
The mature approach is to containerize my app. This solution is lightweight, portable, scalable and will also allow me the ability to collaborate with others on my team. In the past, I would containerize my app by writing a Dockerfile and building my app image with Docker and Docker Compose. If you have had the joy of writing a Dockerfile then you know how painful and tedious this process can be. Some of those challenges are:
- Trying to find the correct container image
- Copying files to and from the correct directory
- Determining the correct storage
- Passing in variables
As a new developer you can spend hours writing and testing this file. See the example below:
Thankfully, experiencing growing pains like this has led me to collaborate with some amazingly smart tech professionals from within Cisco and on the outside of Cisco. One of those professionals is my good friend DaShaun Carter who is a Partner Solution Architect at Redis Labs. Through our recent collaboration he introduced me to cloud native buildpacks. And in this post, I will introduce them to you.
What are Cloud Native Buildpacks?
Buildpacks were first created by Heroku in 2011, but have since been adapted by Cloud Foundry, Pivotal, and several other vendors. A buildpack is everything you need to containerize your app. Simply put, a buildpack examines your app’s source code, then identifies and gathers all the needed dependencies to build a layered container image of your app. This is all done by executing one command. A cool thing to mention is that buildpacks are fully supported and actively updated. This means when there is a vulnerability in your build, by just updating your image with the latest buildpack the vulnerability will be patched. Here’s more on buildpacks.
Do buildpacks remove the need for Docker?
Understand that buildpacks allow you to avoid the pain of building and maintaining a Dockerfile. Docker is still needed to run your container and to manage your Docker images. In the example above, I used the Pack CLI tool and the email@example.com buildpack to build the container image for an app called myaciapp.
The pack CLI tool is a locally installed application that is used to run the buildpacks that build the Docker images. And the Packeto Python buildpack is what contains python, our container environment and everything we need to build our image.
Notice how after running the single “pack build myapp –buildpack firstname.lastname@example.org” command the docker image was created. YES, it is that easy! At this point we can run our app with the same docker commands that we are accustomed to.
NOTE: The reason for the CREATED date of 41 years for the docker image is due to Pack utilizing reproducible builds. Meaning you get the same result each time you run the build.
Now I must state that there is value in understanding what is going on under the hood of a Docker container. To learn more about Docker check out this DevNet Docker 101 Learning Lab.
How to get started with buildpacks?
To get started with buildpacks is simple. All you need is to do is ensure you have Docker installed and then download and install the Pack CLI tool. Then you are good to go. Here’s a link to buildpacks.io where you can walk through setting up your system and using some of their code samples for testing.
Also be sure to check out my DevNet Code Exchange submission where I provide you all the steps you need to get your own Docker image up and running by using buildpacks.
DevNet supports your NetDevOps journey
Tools like Docker and buildpacks are what makes this NetDevOps journey so exciting. There’s always something new to learn. No matter how challenging it may seem, know that there is a huge community to support you here at DevNet. If you have not already started with DevNet, here’s a link to Start Now.
We’d love to hear what you think. Ask a question or leave a comment below.
And stay connected with Cisco DevNet on social!
Visit the new Developer Video Channel