Skip to content

Instantly share code, notes, and snippets.

@rbo
Created December 22, 2020 16:17
Show Gist options
  • Save rbo/4dec23923d41145d37373102361a252d to your computer and use it in GitHub Desktop.
Save rbo/4dec23923d41145d37373102361a252d to your computer and use it in GitHub Desktop.
ONBUILD & buildah
$ cat << EOF > Dockerfile
FROM fedora:latest
RUN touch /foo
ONBUILD RUN touch /bar
EOF
$ cat << EOF > Dockerfile-2
FROM onbuild-image
RUN touch /baz
EOF
$ buildah bud --format=docker -f Dockerfile -t onbuild-image .
STEP 1: FROM fedora:latest
Resolved short name "fedora" to a recorded short-name alias (origin: /etc/containers/registries.conf.d/shortnames.conf)
Getting image source signatures
Copying blob 8fde7942e775 done
Copying config 79fd58dc76 done
Writing manifest to image destination
Storing signatures
STEP 2: RUN touch /foo
STEP 3: ONBUILD RUN touch /bar
STEP 4: COMMIT onbuild-image
Getting image source signatures
Copying blob b4fa6ff1346d skipped: already exists
Copying blob e90546eff3bf done
Copying config fdd6a5ac4f done
Writing manifest to image destination
Storing signatures
--> fdd6a5ac4f9
fdd6a5ac4f9769b55078ff8a4d98463183f5885ed8ff2764b164430c8706678e
$ buildah bud --format=docker -f Dockerfile-2 -t result-image .
STEP 1: FROM onbuild-image
STEP 2: RUN touch /bar
STEP 3: RUN touch /baz
STEP 4: COMMIT result-image
Getting image source signatures
Copying blob b4fa6ff1346d skipped: already exists
Copying blob e90546eff3bf skipped: already exists
Copying blob 4489028f0344 done
Copying config da7b78f02c done
Writing manifest to image destination
Storing signatures
--> da7b78f02c9
da7b78f02c9f302de2826f2f799607cf8013166d9f848e59bbe1f08a5786e94d
$ buildah inspect --format '{{.Docker.Config.OnBuild}}' onbuild-image
[RUN touch /bar]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment