-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
Description
When building an image with docker build .
, the JSON configuration file inside the resulting image contains the wrong image ID in the config.Image
and container_config.Image
fields.
Steps to reproduce the issue:
This script reproduces the issue:
#!/bin/bash
touch f1 f2 f3
cat > Dockerfile <<EOF
FROM scratch
COPY f1 /f1
COPY f2 /f2
COPY f3 /f3
EOF
docker build -f Dockerfile .
IMAGE=$(docker images | head -2 | tail -1 | awk '{print $3}')
docker save ${IMAGE} > image.tar
CONFIGFILE=$(tar xOf image.tar manifest.json | jq '.[0].Config')
CONFIGFILE=${CONFIGFILE#\"}
CONFIGFILE=${CONFIGFILE%\"}
CONFIGID=$(tar xOf image.tar ${CONFIGFILE} | jq '.config.Image')
echo "Docker image ID is ${IMAGE} but config file has image ${CONFIGID}"
echo "Image history:"
docker history ${IMAGE}
Describe the results you received:
The image ID in the image JSON configuration is different to the image ID docker uses for the image. The one in the JSON file is in fact the ID of the parent image.
Describe the results you expected:
I expected that the JSON would contain the correct image ID in the config.Image
field.
Additional information you deem important (e.g. issue happens only occasionally):
None.
Output of docker version
:
$ docker version
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.1
Git commit: e68fc7a
Built: Fri Jan 25 14:33:51 2019
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.1
Git commit: e68fc7a
Built: Thu Jan 24 10:49:48 2019
OS/Arch: linux/amd64
Experimental: false
Output of docker info
:
$ docker info
Containers: 62
Running: 0
Paused: 0
Stopped: 62
Images: 520
Server Version: 18.06.1-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: (expected: 468a545b9edcd5932818eb9de8e72413e616e86e)
runc version: N/A (expected: 69663f0bd4b60df09991c08812a60108003fa340)
init version: v0.18.0 (expected: fec3683b971d9c3ef73f284f176672c44b448662)
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.15.0-45-generic
Operating System: Ubuntu 18.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 19.49GiB
Name: newt
ID: TXYZ:BBF3:KHVB:3ZYD:TXO6:RCQH:E7HG:HEUP:5F5C:VATF:NFHB:DUP6
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
Additional environment details (AWS, VirtualBox, physical, etc.):
Physical system on x86_64 hardware.