BuildKit as a Service in Okteto Cloud

Image of BuildKit as a Service in Okteto Cloud

We are thrilled to announce that you can now build Docker images from your local source code directly in Okteto Cloud, all powered by BuildKit. Another reason to remove Docker and Kubernetes from your laptop and develop directly in Kubernetes!

Why should I build my images on remote?

BuildKit is one of the most amazing projects out there. It lets us build Docker images faster and more securely than ever. But no matter how fast BuildKit is, if you are building Docker images, you still need to pull your base images and push the new images to the registry before updating your applications. Depending on your network connection, this process can take minutes. And you need Docker running locally, consuming CPU cycles, memory and battery.

Our new BuildKit as Service feature lets you build your images directly in Okteto Cloud, dramatically cutting down your build times, independently of your network connection. And since it’s powered by BuildKit, it’ll just work with your existing Dockerfiles and Docker registries.

How do I use it?

If you haven’t done it yet, you need to install the Okteto CLI and run okteto login. From that moment, you get full access to run remote builds in Okteto Cloud via the okteto build command:

1
$ okteto build -t okteto/hello-world:golang .
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[+] Building 3.0s (16/16) FINISHED                      
=> importing cache manifest from okteto/hello-world:golang 1.2s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.1s
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 32B 0.1s
=> [internal] load metadata for docker.io/library/alpine:latest 0.6s
=> [internal] load metadata for docker.io/library/golang:alpine 0.7s
=> [builder 1/5] FROM docker.io/library/golang:[email protected]:9d2a7c5b64... 0.0s
=> => resolve docker.io/library/golang:[email protected]:9d2a7c5b64... 0.0s
=> [prod 1/3] FROM docker.io/library/[email protected]:c19173c5ad... 0.0s
=> => resolve docker.io/library/[email protected]:c19173c5ad... 0.0s
=> [internal] load build context 0.2s
=> => transferring context: 8.91kB 0.2s
=> CACHED [prod 2/3] WORKDIR /app 0.0s
=> CACHED [builder 2/5] RUN apk --update add --no-cache bash 0.0s
=> CACHED [builder 3/5] WORKDIR /app 0.0s
=> CACHED [builder 4/5] ADD . . 0.0s
=> CACHED [builder 5/5] RUN go build -o app 0.0s
=> CACHED [prod 3/3] COPY --from=builder /app/app /app/app 0.0s
=> exporting to image 1.3s
=> => exporting layers 0.0s
=> => exporting manifest sha256:868d53a5f5... 0.0s
=> => exporting config sha256:5fc2c264be... 0.0s
=> => pushing layers 1.1s
=> => pushing manifest for docker.io/okteto/hello-world:golang 0.1s
=> exporting cache 0.1s
=> => preparing build cache for export 0.1s

The syntax is very similar to docker build. The main difference is that okteto build automatically pushes the images to the registry if the flag --tag is specified. Check the docs for more details.

How do you like it?

We would ❤️ to hear what you think about builds on remote as a service. You can reach us on twitter, or in our channel in the Kubernetes slack.