tilt icon indicating copy to clipboard operation
tilt copied to clipboard

`os.putenv()` doesn't apply for `docker_build()`

Open Raboo opened this issue 2 years ago • 4 comments

Expected Behavior

This:

os.putenv('DOCKER_BUILDKIT', '0')
docker_build(
  '{}/{}'.format(DOCKER_NAMESPACE, DOCKER_REPO),
  DOCKER_FOLDER,
)

doesn't seem to work, the environment variable DOCKER_BUILDKIT is not applied in the context that executes docker_build() it seems.

Current Behavior

running DOCKER_BUILDKIT=0 tilt ci seems to have the desired effect, but os.putenv('DOCKER_BUILDKIT', '0') does not.

Context

tilt doctor Output

$ tilt doctor
Tilt: v0.31.1, built 2023-01-09
System: darwin-arm64
---
Docker
- Host: unix:///var/run/docker.sock
- Server Version: 4.3.1
- API Version: 1.41
- Builder: 2
- Compose Version: v2.6.1
---
Kubernetes
- Env: unknown
- Context: workloads
- Cluster Name: workloads
- Namespace: usersync-accept
- Container Runtime: docker
- Version: v1.22.9
- Cluster Local Registry: none
---

Raboo avatar Feb 15 '23 17:02 Raboo

Yes, tilt's docker_build currently works by creating a connection to the builder at startup, before tiltfile execution. there's currently not a way to configure that connection from the tiltfile.

nicks avatar Feb 16 '23 14:02 nicks

So, it's not a bug, just an limitation that can't be overcome? Or perhaps there will be another way to overcome this limitation?

Raboo avatar Feb 17 '23 09:02 Raboo

It's not impossible to add, just non-trivial.

The workaround right now is to set DOCKER_BUILDKIT=0 before tilt starts. I guess you could also use a custom_build that sets it, though that'd be a bit slower because it recreates the connection each time.

Unrelated side question - why do you want to disable buildkit?

nicks avatar Feb 17 '23 20:02 nicks

Unrelated side question - why do you want to disable buildkit?

Using Podman Desktop on MacOS, it creates a /var/run/docker.sock socket but has no support for buildkit. It pretty much compatible with Docker features except buildkit and keeps everything simple, better than all alternatives like nerdctl/lima-vm, Rancher Dekstop, etc. So if you want you can keep using the "docker" binary or socket but with a Podman desktop backend which is perfect for some tool that don't have first class support for podman.

I decided to move to Podman Desktop since Docker for Desktop started requiring license for commercial use, and to be honest, I prefer Open Source software on my computer.

Raboo avatar Feb 17 '23 23:02 Raboo