I had heard about
acr build when it came out and didn’t pay much attention to it. I was like “I don’t wanna send my whole build context over the internet that’s crazy.” That was kinda a facepalm in retrospect because it’s kinda sorta my job to keep up on Azure things that are container related.
Anyway, now that I actually looked at this thing, I have some feels and codes!
I was looking at Brian’s acrtasks repo the other day and really learned what Azure Container Registry tasks are about. You run
acr build and the CLI zips up your local build context, sends it to the server, and that does the
docker build for you. Not that exciting, but as Brian said, it’ll automatically re-build when base images change. Rad!
Here’s some more rad things that I like even better than that:
- I don’t need a local Docker daemon!
- I don’t have to push image layers up to a registry
- I don’t have to do registry auth — just auth to Azure
- I don’t need a local Docker daemon
- I don’t need a local Docker daemon :P
Basically, I can just write my
Dockerfile and run
acr build without setting up the daemon. I’d want to on my dev machine, but I don’t have to figure it out in other places:
- CI/CD systems like Buildkite or Travis. Travis has Docker support but you have to spin up a whole VM. You can run Buildkite agents on Kubernetes too
- … I’ve gotten that working in two different ways — running in docker-in-docker and mounting the underlying node’s docker port into the pod.
- … either way is crazytown and I’ll die on that hill 😉
- I repeat: don’t let pods talk to the external Docker daemon. And DinD comes with its own headaches. There’s a reason I have no hair 😆!
- Underpowered systems — Ever try building Buffalo on a Raspberry Pi? Not fast, kinda painful
Basically, I just feel like not having to run a Docker daemon sometimes is one less thing to worry about. And it’s a big, awesome think to be able to ignore it.
Getting real again, I basically wanted to do
docker builds on my dev machines and
az acr builds playing with Buildkite and similar stuff. I pretty quickly got tired of writing the same bash script to decide which one to use. So I wrote this little, super basic tool that just does the
if for me.
Basically you do this:
bld -t my/image .
docker build if the Docker CLI is in your PATH, otherwise does
az acr build. It’s suuuper basic and that’s kinda the point (at least right now). You decide whether you want
docker build or
az acr build based on whether you have
docker (the CLI) installed.
Other Stuff Already Exists
Yup, and honestly lots of it is better and I might steal it :P
The coolest thing I know of is part of
draft. The rad bacongobbler saw this and DM’d me with this code in the project. The basic difference between
draft is that the former is just for building Docker images. The latter is for everything from coding to deploying to Kubernetes.
By the way, Draft is really awesome and you should 100% check it out!
I want to keep this thing simple and I’m not sure whether to shamelessly steal use that code or just keep relying on
az. To be determined I guess!
Keep on rockin’
Originally published at arschles.com.