Jul 10th, 2022

Running Container Workloads on Anzu with Managed Containers

While some projects require complex setups and resources from different cloud providers, sometimes you just want to run a container in the cloud and we hear you!

Today, Anzu is introducing Managed Containers, a dead-simple way to get your container running in the cloud. The best part? For exploration purposes, you get a free container for a whole week!

You can deploy your first container in seconds, I’ll spend the rest of this post going over what you can do with it!

Getting Started

Creating our demo application

Note: If you want to skip ahead to deploying the demo application, you can use the image brunoscheufler/anzu-demo-application:latest which we’ll build below.

Let’s start by creating our demo application. We’ll write a simple Node.js app that returns hello world, so the usual.

const http = require('http');

const server = http.createServer();

const port = parseInt(process.env.PORT || '8080');

server.on('request', async (_, res) => {
  res.writeHead(200, { 'Content-Type': 'application/json' });
  res.end(JSON.stringify({ message: 'Hello world from Anzu!' }));
});

server.listen(port, () => console.log(`Server is running!`));

We’ll also write a simple Dockerfile that includes our code (index.js stores the code above).

FROM node:18.5.0-alpine3.16

WORKDIR /app

COPY index.js .

CMD node index.js

Next, let’s build and push our image! To make our image run with Managed Containers on Anzu, we need to build it for ARM64 as well, which is straightforward to do with BuildKit. We’ll push the image to Docker Hub, but you can use any public registry for this guide.

# create a temporary builder
docker buildx create --name builder

docker buildx use builder

# note: swap this with
export IMAGE_TAG=brunoscheufler/anzu-demo-application:latest

# if you have not signed in to Docker Hub, run docker login

# build, tag, and push image for both amd64 and arm64
docker buildx build \
	--platform linux/amd64,linux/arm64 \
	-t $IMAGE_TAG \
	--push .

docker buildx rm builder

With our image built and pushed, we can go ahead and deploy it!

Deploying our demo application

If this is your first visit, you need to create an account first. Start by heading over to the dashboard, then go into your example project.

dashboard

Next, go to + Add more in the provider section (or + Provider in the header), select managed-containers, select the top-most version, and confirm.

You should now be back to the branch dashboard, where the newly-added provider will show up.

Next, you can create a Managed Container resource by clicking + Add resource (or + Resource), and selecting Managed Container.

resource editing

Paste your image name, and confirm with + Add resource.

Now, click Deploy in the header. This will navigate you to creating your first deploy request.

deploy request

Simply click + Create (the default branch and environment were selected for you). On the next view, you can see all changes that will be deployed (the deployment plan). Click Approve once you’re all set.

deployment

You’ll be redirected to the deployment screen. After a couple of seconds, your container should be deployed! You can now go to Environmentsdemo application to view your created resource and copy its endpoint. This is where you can reach the deployed demo application!

output view

To verify everything worked, let’s send a simple GET request! It may take a couple of seconds for the certificate to be provisioned, just try again if you run into certificate issues. Ping us if any issues persist 👍

terminal

That was easy, you just deployed your first Managed Container 🎉

Currently, all Managed Container instances will run for a week after which they will be terminated, we’ll notify you about that. If you’d be interested to run instances on Anzu permanently, please get in touch!

A powerful ecosystem

Traditional PaaS providers strive to offer a vertically-integrated system that is hard to connect with external services. But from our experience and interviews with many teams, we know that containers rarely come alone.

From persistence like storage and databases over monitoring to networking, there’s a lot more to the typical infrastructure, and teams want to be in control. It’s really nice to get something working out of the box, so traditionally, there has been a trade-off between ease of use and extensibility.

With Anzu, we’re trying to bridge the gap: You shouldn’t have to work hard to provision the best possible architecture. Best practices shouldn’t be exclusive to bigger companies with dedicated infrastructure teams.

Power comes with having choices, so Anzu will never force you into vendor lock-in with any cloud provider. You decide what you want to run, where you want it to run, and we make sure you’re set up with everything you need from day zero.

Starting small

A container is the atomic unit that powers today’s world of compute. A self-contained environment that can run almost anywhere, containers scale with you. Over time, you can add more dependencies and services easily, and everyone can run the exact same workloads.

We’re super excited about what you’ll build with Anzu and Managed Containers, if you have any questions, suggestions, or feedback in general, please let us know!

Bruno Scheufler

Software Engineering, Management

Projects

On other platforms