mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
image-inspect: remove Config fields that are not part of the image
commitaf0cdc36c7marked these fields as deprecated and to be removed in API v1.47 (which was targeted for v28.0). We shipped v1.47 with the v27.2 release, but did not yet remove the erroneous fields, so the version to deprecate was updated to v1.48 through3df03d8e66This patch removes fields that are not part of the image by replacing the type with the Config struct from the docker image-spec. curl -s --unix-socket /var/run/docker.sock http://localhost/v1.50/images/alpine/json | jq .Config { "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "Cmd": [ "/bin/sh" ] } curl -s --unix-socket /var/run/docker.sock http://localhost/v1.49/images/alpine/json | jq .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" ], "Cmd": [ "/bin/sh" ], "Image": "", "Volumes": null, "WorkingDir": "", "Entrypoint": null, "OnBuild": null, "Labels": null } Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -166,7 +166,6 @@ func (s *DockerRegistrySuite) TestRemoveImageByDigest(c *testing.T) {
|
||||
}
|
||||
|
||||
func (s *DockerRegistrySuite) TestBuildByDigest(c *testing.T) {
|
||||
skip.If(c, testEnv.UsingSnapshotter(), "Config.Image is not created with containerd, buildkit doesn't set it either")
|
||||
imgDigest, err := setupImage(c)
|
||||
assert.NilError(c, err, "error setting up image")
|
||||
|
||||
@@ -175,9 +174,6 @@ func (s *DockerRegistrySuite) TestBuildByDigest(c *testing.T) {
|
||||
// pull from the registry using the <name>@<digest> reference
|
||||
cli.DockerCmd(c, "pull", imageReference)
|
||||
|
||||
// get the image id
|
||||
imageID := inspectField(c, imageReference, "Id")
|
||||
|
||||
// do the build
|
||||
const name = "buildbydigest"
|
||||
buildImageSuccessfully(c, name, build.WithDockerfile(fmt.Sprintf(
|
||||
@@ -185,10 +181,9 @@ func (s *DockerRegistrySuite) TestBuildByDigest(c *testing.T) {
|
||||
CMD ["/bin/echo", "Hello World"]`, imageReference)))
|
||||
assert.NilError(c, err)
|
||||
|
||||
// get the build's image id
|
||||
res := inspectField(c, name, "Config.Image")
|
||||
// make sure they match
|
||||
assert.Equal(c, res, imageID)
|
||||
// verify the build was ok
|
||||
res := inspectField(c, name, "Config.Cmd")
|
||||
assert.Equal(c, res, `[/bin/echo Hello World]`)
|
||||
}
|
||||
|
||||
func (s *DockerRegistrySuite) TestTagByDigest(c *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user