Image Shas different for consecutive builds with `docker.#Dockerfile`
What is the issue?
When building a docker image from a dockerfile to push to a registry, I'd expect the image sha of the image built with each dagger pipeline execution to be the same from execution to execution if nothing changes with the context or the Dockerfile. It appears that I instead sometimes see a unique sha for each image created by each execution of the same pipeline.
Log output
This is the log from the running the same command over & over with the same inputs. You can see that sometimes it will generate an image with the same sha256 that starts with 87 but other times (the very last execution for example) it generates an image with a different sha256.
britz:~/myprojects/minimal-example$dagger-cue version
dagger 0.2.232 (cbcb5061e) darwin/amd64
britz:~/myprojects/minimal-example$dagger-cue --log-format plain do loadDocker
1:56PM INFO actions.loadDocker._defaultImage._pull | computing
1:56PM INFO client.network."unix:///var/run/docker.sock" | computing
1:56PM INFO actions.source | computing
1:56PM INFO client.network."unix:///var/run/docker.sock" | completed duration=0s
1:56PM INFO actions.source | completed duration=0s
1:56PM INFO actions.buildDocker._build | computing
1:56PM INFO actions.buildDocker._build | completed duration=200ms
1:56PM INFO actions.loadDocker._export | computing
1:56PM INFO actions.loadDocker._defaultImage._pull | completed duration=300ms
1:56PM INFO actions.loadDocker._export | completed duration=200ms
1:56PM INFO actions.loadDocker._exec | computing
1:56PM INFO actions.loadDocker._exec | #10 0.315 Loaded image: myimage:latest
1:56PM INFO actions.loadDocker._exec | completed duration=400ms
Field Value
imageID "sha256:8728791cc93948f08a704d294f6879f3cbf24b5baddbf80cb4d037bc930c505a"
britz:~/myprojects/minimal-example$dagger-cue --log-format plain do loadDocker
1:56PM INFO actions.loadDocker._defaultImage._pull | computing
1:56PM INFO actions.source | computing
1:56PM INFO client.network."unix:///var/run/docker.sock" | computing
1:56PM INFO client.network."unix:///var/run/docker.sock" | completed duration=0s
1:56PM INFO actions.source | completed duration=0s
1:56PM INFO actions.buildDocker._build | computing
1:56PM INFO actions.buildDocker._build | completed duration=200ms
1:56PM INFO actions.loadDocker._export | computing
1:56PM INFO actions.loadDocker._defaultImage._pull | completed duration=300ms
1:56PM INFO actions.loadDocker._export | completed duration=300ms
1:56PM INFO actions.loadDocker._exec | computing
1:56PM INFO actions.loadDocker._exec | completed duration=300ms
1:56PM INFO actions.loadDocker._exec | #10 0.276 Loaded image: myimage:latest
Field Value
imageID "sha256:8728791cc93948f08a704d294f6879f3cbf24b5baddbf80cb4d037bc930c505a"
britz:~/myprojects/minimal-example$dagger-cue --log-format plain do loadDocker
1:56PM INFO actions.loadDocker._defaultImage._pull | computing
1:56PM INFO actions.source | computing
1:56PM INFO client.network."unix:///var/run/docker.sock" | computing
1:56PM INFO client.network."unix:///var/run/docker.sock" | completed duration=0s
1:56PM INFO actions.source | completed duration=0s
1:56PM INFO actions.buildDocker._build | computing
1:56PM INFO actions.buildDocker._build | completed duration=200ms
1:56PM INFO actions.loadDocker._export | computing
1:56PM INFO actions.loadDocker._defaultImage._pull | completed duration=300ms
1:56PM INFO actions.loadDocker._export | completed duration=300ms
1:56PM INFO actions.loadDocker._exec | computing
1:56PM INFO actions.loadDocker._exec | completed duration=300ms
1:56PM INFO actions.loadDocker._exec | #10 0.268 The image myimage:latest already exists, renaming the old one with ID sha256:8728791cc93948f08a704d294f6879f3cbf24b5baddbf80cb4d037bc930c505a to empty string
1:56PM INFO actions.loadDocker._exec | #10 0.269 Loaded image: myimage:latest
Field Value
imageID "sha256:aa74e70707cdbbdf90d1e860a4fbb9b8e140d2175e15390178c551891490bcfe"
Steps to reproduce
dagger.cue
package minimal
import (
"dagger.io/dagger"
"universe.dagger.io/docker/cli"
"dagger.io/dagger/core"
"universe.dagger.io/docker"
)
dagger.#Plan & {
// client: filesystem: ".": read: contents: dagger.#FS
client: network: "unix:///var/run/docker.sock": connect: dagger.#Socket
actions: {
// Load the todoapp source code
source: core.#Source & {
path: "."
exclude: [
"build",
"*.cue",
"*.md",
".git",
"cue.mod",
]
}
buildDocker: docker.#Dockerfile & {
// https://docs.dagger.io/sdk/cue/966156/docker#dockerdockerfile
source: actions.source.output
}
loadDocker: cli.#Load & {
image: buildDocker.output
host: client.network."unix:///var/run/docker.sock".connect
tag: "myimage"
}
}
}
Dockerfile
FROM busybox:latest
ENV THIS=1
Run dagger-cue --log-format plain do loadDocker
Dagger version
dagger 0.2.232 (cbcb5061e) darwin/amd64
OS version
MacOS