tilt: ERROR: ImageBuild: COPY failed
Hi guys,
I have updated Tilt to the latest version (0.9.7) today and since then I’m experiencing this type of errors for all my docker images :
ERROR: ImageBuild: COPY failed: stat /var/lib/docker/tmp/docker-builder817293152/build/libs/app-1.0-SNAPSHOT.jar: no such file or directory
DockerFile looks like this :
FROM adoptopenjdk/openjdk11:jdk-11.0.2.9-slim
COPY ./build/libs/app-1.0-SNAPSHOT.jar /app.jar
CMD ["java", "-jar", "-XX:-OmitStackTraceInFastThrow", "/app.jar"]
It is my understand it’s bad practice to have relative paths in DockerFile, I’ve tried using an absolute path but the same issue occurred.
I have downgraded Tilt to version 0.9.4
and it works again. As a work around, I have configured brew to not auto update tilt but as you can imagine I would prefer to stay up to date with upgrades.
DOCKER_BUILDKIT=0 docker build -t x .
and DOCKER_BUILDKIT=1 docker build -t x .
both work locally.
I’m running on MacOs Mojave 10.14.6.
here is the tilt doctor
:
System: darwin-amd64
---
Docker
- Host: tcp://192.168.64.2:2376
- Version: 1.39
- Builder: 1
---
Kubernetes
- Env: minikube
- Context: minikube
- Cluster Name: minikube
- Namespace: default
- Container Runtime: docker
- Version: v1.15.0
---
Thanks for seeing the Tilt Doctor!
Please send this info along when filing bug reports. 💗
Thanks !
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (12 by maintainers)
Commits related to this issue
- repo case for https://github.com/windmilleng/tilt/issues/1982 — committed to nicks/tilt-issue1982 by nicks 5 years ago
check added in https://github.com/windmilleng/tilt/pull/2017
Short answer: @kalistace : you can work around this by changing the
docker_build
call toonly='build/libs'
Long answer: Tilt does not currently support
*
globs inonly=...
. That’s because Tilt implementsonly='foo'
as adockerignore
with the contents:If you have
only='**/build/libs'
, Tilt creates a dockerignore like:Unfortunately, Docker doesn’t support this (https://github.com/moby/moby/issues/30018). If you’d like to try it out yourself, there’s a repro case in this temporary repo: https://github.com/nicks/tilt-issue1982.
This broke because we were updating Tilt’s
dockerignore
implementation to be more consistent with Docker’sdockerignore
implementation. For a bunch of reasons, it’s super difficult to implement exclude-globs in a performant way (which is why I suspect this hasn’t been fixed in Docker core)There are a couple possible ways we could move forward here. Maybe we could fix this, and find a performant way to implement it. Alternatively, Tilt should error if you try to use globs in
only=
parameters.I could see arguments for or against being consistent with Docker, even when it means replicating their bugs. @jazzdan what do you think?
thanks! I think I have a repro case. It has something to do with the
only=
I don’t have one ah ! 😃
I think I have narrowed it down a little bit more, it seems related to the
only
parameter from thedocker_build
function.I have removed it for try-and-error debug and it worked.
Here is a snippet from my Tiltfile to illustrate my point :
Ends up with the error:
Doesn’t end up with an error, but also if not fit for my purpose:
If you’re curious as to why I want this behaviour: Allows me to only rebuild manually when I want it, that is when I’m happy with my code change, I run
gradle clean install
, it builds my jar and deploys it to my local k8s.Hope that helps.
whoops, I feel silly.