Open rainersigwald opened 2 years ago
Built with
docker build . -t docker-working
and then exported with
docker save docker-working -o tryagain.tar.gz
Then extracted stuff from the tarballs.
Diffing the configuration JSON from the aspnet base image to the app:
diff --git "a/.\\aspnet_config.json" "b/.\\app_config.json"
index 185d2fe..16f934a 100644
--- "a/.\\aspnet_config.json"
+++ "b/.\\app_config.json"
@@ -1,15 +1,6 @@
{
"architecture": "amd64",
"config": {
- "Hostname": "",
- "Domainname": "",
- "User": "",
- "AttachStdin": false,
- "AttachStdout": false,
- "AttachStderr": false,
- "Tty": false,
- "OpenStdin": false,
- "StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"ASPNETCORE_URLS=http://+:80",
@@ -17,47 +8,14 @@
"DOTNET_VERSION=6.0.5",
"ASPNET_VERSION=6.0.5"
],
- "Cmd": [
- "bash"
+ "Entrypoint": [
+ "dotnet",
+ "DotNet.Docker.dll"
],
- "Image": "sha256:008812f3e2ee4fb98ce114e859edd5707eadc829976b63c4274c648495f35b96",
- "Volumes": null,
- "WorkingDir": "",
- "Entrypoint": null,
- "OnBuild": null,
- "Labels": null
+ "WorkingDir": "/app",
+ "OnBuild": null
},
- "container_config": {
- "Hostname": "",
- "Domainname": "",
- "User": "",
- "AttachStdin": false,
- "AttachStdout": false,
- "AttachStderr": false,
- "Tty": false,
- "OpenStdin": false,
- "StdinOnce": false,
- "Env": [
- "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
- "ASPNETCORE_URLS=http://+:80",
- "DOTNET_RUNNING_IN_CONTAINER=true",
- "DOTNET_VERSION=6.0.5",
- "ASPNET_VERSION=6.0.5"
- ],
- "Cmd": [
- "/bin/sh",
- "-c",
- "#(nop) COPY dir:28d38ad4b94be53345d58212d462f052eb3caf9910d61f4881996aefce649cdc in /usr/share/dotnet/shared/Microsoft.AspNetCore.App "
- ],
- "Image": "sha256:008812f3e2ee4fb98ce114e859edd5707eadc829976b63c4274c648495f35b96",
- "Volumes": null,
- "WorkingDir": "",
- "Entrypoint": null,
- "OnBuild": null,
- "Labels": null
- },
- "created": "2022-05-28T08:33:01.277080173Z",
- "docker_version": "20.10.12",
+ "created": "2022-06-08T14:58:30.4770187Z",
"history": [
{
"created": "2022-05-28T01:20:23.14142546Z",
@@ -98,6 +56,22 @@
{
"created": "2022-05-28T08:33:01.277080173Z",
"created_by": "/bin/sh -c #(nop) COPY dir:28d38ad4b94be53345d58212d462f052eb3caf9910d61f4881996aefce649cdc in /usr/share/dotnet/shared/Microsoft.AspNetCore.App "
+ },
+ {
+ "created": "2022-06-07T21:59:35.7021854Z",
+ "created_by": "WORKDIR /app",
+ "comment": "buildkit.dockerfile.v0"
+ },
+ {
+ "created": "2022-06-08T14:58:30.4770187Z",
+ "created_by": "COPY /app/out . # buildkit",
+ "comment": "buildkit.dockerfile.v0"
+ },
+ {
+ "created": "2022-06-08T14:58:30.4770187Z",
+ "created_by": "ENTRYPOINT [\"dotnet\" \"DotNet.Docker.dll\"]",
+ "comment": "buildkit.dockerfile.v0",
+ "empty_layer": true
}
],
"os": "linux",
@@ -108,7 +82,9 @@
"sha256:c891b6c5469a0e8b72be529a7d376390a28f73494008378568daae8eedb8c59c",
"sha256:d1597429d57f28f871e2beae11ecfd1e7059e60ccc993740d9e9649160e7b299",
"sha256:bb19eedc1dadf615d9c11ff380d04c0832a4116eeb485402e1a9430d5c5f4171",
- "sha256:d89241eb9d34d28239f19314a11c3680b00245900ec6205f5ccb5413c0c4c8b3"
+ "sha256:d89241eb9d34d28239f19314a11c3680b00245900ec6205f5ccb5413c0c4c8b3",
+ "sha256:b0568b469bc5124fede5a540b7dbb12dd4a3eedac9035677111ed076eb6558c8",
+ "sha256:127dfa91300b70c4ba276d8b56a4ade0d092fc21be88efd9f25f10f547f4167b"
]
}
}
\ No newline at end of file
Why two new layers?
b0568b469bc5124fede5a540b7dbb12dd4a3eedac9035677111ed076eb6558c8
doesn't appear to be in the actual tarball.
❯ docker save sha256:b0568b469bc5124fede5a540b7dbb12dd4a3eedac9035677111ed076eb6558c8 -o b0568.tar.gz
Error response from daemon: failed to get digest sha256:b0568b469bc5124fede5a540b7dbb12dd4a3eedac9035677111ed076eb6558c8: open /var/lib/docker/image/overlay2/imagedb/content/sha256/b0568b469bc5124fede5a540b7dbb12dd4a3eedac9035677111ed076eb6558c8: no such file or directory
Also those shas aren't the same ones that are in manifest.json
where the diff is
diff --git "a/.\\aspnet_manifest.json" "b/.\\app_manifest.json"
index 436fc34..042a95b 100644
--- "a/.\\aspnet_manifest.json"
+++ "b/.\\app_manifest.json"
@@ -1,15 +1,17 @@
[
{
- "Config": "69cb014b394b2fc1145dcf0f1630582dea6374e2380ef0ea233ec4b4e74ac38b.json",
+ "Config": "d702a3b6aabdda94be5f6fe12c9335edfeae95985582da19e1c5476cfd5a4da5.json",
"RepoTags": [
- "mcr.microsoft.com/dotnet/aspnet:6.0"
+ "docker-working:latest"
],
"Layers": [
"b8c3926d6865a53a5b55a36e83878172f0af98ba1e9970fc32e399d57cebf890/layer.tar",
"20f131c3f2d035fc89604cf8c2a3402418bb9d0e5bb4a9b448ff306fc8817164/layer.tar",
"8761f2edb96c37d32e3eabc52cd048185eb2d3a15c3c33aca39f1691509df5d8/layer.tar",
"c9d301e65908bfe3cc41ae6990f25daa6fea155d987c7d71c400be7511fb2b40/layer.tar",
- "7bb73e39601679f5e6310a5a3f49a5a03630762f3635743d65eda1c3646f0738/layer.tar"
+ "8fe4de8faa2aa6c5d970fc3ca868bb982d444cc4e2a6e5cca29a4fcb44dad6c9/layer.tar",
+ "1e4d6fe98b7379138724795152f299462ed7639bbdb4d2e3d610bae6cc6fd556/layer.tar",
+ "50227d463063104c1b5a1e3c0f5de5fa4a4dfff6714ea1c7221e5685aae9fcf8/layer.tar"
]
}
]
\ No newline at end of file
Here, there is one DIFFERENT layer and two new ones?
In the base image, there's aspnet_6.0.tar.gz\7bb73e39601679f5e6310a5a3f49a5a03630762f3635743d65eda1c3646f0738\layer.tar\usr\share\dotnet\shared\Microsoft.AspNetCore.App\6.0.5\
In the derived, tryagain.tar.gz\8fe4de8faa2aa6c5d970fc3ca868bb982d444cc4e2a6e5cca29a4fcb44dad6c9\layer.tar\usr\share\dotnet\shared\Microsoft.AspNetCore.App\6.0.5\
So a subtle difference?
The two subsequent layers have
tryagain.tar.gz\1e4d6fe98b7379138724795152f299462ed7639bbdb4d2e3d610bae6cc6fd556\layer.tar\app\.wh..wh..opq
-- so "delete everything in the /app
directory"
and then
tryagain.tar.gz\50227d463063104c1b5a1e3c0f5de5fa4a4dfff6714ea1c7221e5685aae9fcf8\layer.tar\app\DotNet.Docker.dll
and friends, as expected
These are all by the way via
❯ docker --version
Docker version 20.10.16, build aa7e414
In the base image, there's
aspnet_6.0.tar.gz\7bb73e39601679f5e6310a5a3f49a5a03630762f3635743d65eda1c3646f0738\layer.tar\usr\share\dotnet\shared\Microsoft.AspNetCore.App\6.0.5\
In the derived,
tryagain.tar.gz\8fe4de8faa2aa6c5d970fc3ca868bb982d444cc4e2a6e5cca29a4fcb44dad6c9\layer.tar\usr\share\dotnet\shared\Microsoft.AspNetCore.App\6.0.5\
So a subtle difference?
Looking at the JSON next to the tarball, it looks like they differ in env and cmd settings--which I didn't even know could be part of a layer.
I started with an example project from
https://docs.microsoft.com/dotnet/core/docker/build-container
And am dumping some notes as I play with things.