tilt icon indicating copy to clipboard operation
tilt copied to clipboard

live update doesn't work on rancher desktop / windows

Open nicks opened this issue 3 years ago • 9 comments

From the tilt channel:

I cannot get live_update working on Windows. Tried one Win 10 machine and one Win 11 machine. Same issue on both.
The tar command never finish, it just hangs. Is it supposed to call C:\Windows\System32\tar.exe, because that is what is think is happening (I get the same result if I open up a terminal in windows and execute tar -C / -x -f -)
Will copy 1 file(s) to container: [tilt-frontend-demo-847d79b47b-kn5xd/tilt-frontend-demo]
- 'C:\Repositories\tilt-frontend-demo\src\App.js' --> '/src/src/App.js'
RUNNING: tar -C / -x -f -

Output of tilt doctor:

Tilt: v0.27.3, built 2022-04-22
System: windows-amd64
---
Docker
- Host: [default]
- Server Version: 20.10.11
- API Version: 1.41
- Builder: 2
---
Kubernetes
- Env: rancher-desktop
- Context: rancher-desktop
- Cluster Name: rancher-desktop
- Namespace: default
- Container Runtime: read-failure
- Version: v1.23.5+k3s1
- Cluster Local Registry: none

nicks avatar Apr 25 '22 14:04 nicks

i can repro but haven't figured out what the issue is yet

nicks avatar Apr 25 '22 14:04 nicks

OK, confirmed that this is a bug in Rancher Desktop (or one of its subcomponents). You can reproduce it from the commandline. Launch any container in Rancher Desktop, then run:

echo hi | docker exec -i [CONTAINER] cat -

On Docker Desktop, this command prints 'hi', then exits.

On Rancher Desktop, this command prints 'hi', then hangs indefinitely.

Other details

On Docker Desktop, tilt does live_update commands directly through the container runtime (docker exec) rather than through the apiserver (kubectl exec). In theory, we could add a workaround for Rancher Desktop, but this would still be broken for other things (e.g., docker-compose on rancher desktop) so probably better to get it fixed upstream.

nicks avatar Apr 25 '22 16:04 nicks

Thanks for the detailed explanation. I managed to solve the issue with live_update by switching from dockerd to containerd runtime in rancher desktop. And in the tiltfile use nerdctl_build instead of docker_build. Works great!

So there is only a issue when you use rancher desktop for windows + rancher dockerd runtime + tile.

jesperume avatar Apr 26 '22 07:04 jesperume

ooh that's a good workaround thanks!!

nicks avatar Apr 26 '22 14:04 nicks

Thanks for the detailed explanation. I managed to solve the issue with live_update by switching from dockerd to containerd runtime in rancher desktop. And in the tiltfile use nerdctl_build instead of docker_build. Works great!

So there is only a issue when you use rancher desktop for windows + rancher dockerd runtime + tile.

I can confirm this works as a fix for me as well!

Go2Engle avatar Apr 28 '22 15:04 Go2Engle

If anyone else needs another workaround you can use devcontainers in vscode as well. Set rancher desktop to moby. configure your project with devcontainer running on ubuntu (in my case). Config devcontainer for docker from docker and install tilt and kubectl inside container. Copy over kube config to container. Profit! If anyone wants my configs how this is setup please take a look at the sample project I tossed together https://github.com/Go2Engle/tilt-in-devcontainer

Go2Engle avatar May 12 '22 12:05 Go2Engle

@Go2Engle Have you been able to get live update to work with vscode devcontainer and docker compose? I have tried rancher desktop and docker desktop on two different computers. I have tried docker-in-docker and docker-with-docker on both systems. Either way, live update never picks up the changes. As soon as I open locally, boom live update off and running.

Don't want to hijack this issue, if have this working then I will keep searching. I just searched for devcontainer and found this issue.

nahlian avatar Jun 13 '22 19:06 nahlian

@nahlian I dont have much experience with devcontainer with docker compose. Feel free to shoot me an email(found on my profile) and id be glad test for you.

Go2Engle avatar Jun 14 '22 11:06 Go2Engle