Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1092781

Summary: NetworkSettings are not written out in container config on exit
Product: Red Hat Enterprise Linux 7 Reporter: J.C. Molet <jmolet>
Component: dockerAssignee: Daniel Walsh <dwalsh>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.1CC: bsarathy, cevich, dwalsh, lsm5
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-18 20:45:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1109938, 1138364    

Description J.C. Molet 2014-04-30 01:47:32 UTC
Description of problem:
NetworkSettings are not written out in a container's config.json when the container exits, and its values differ from the docker inspect output

Version-Release number of selected component (if applicable):
# docker version
Client version: 0.10.0
Client API version: 1.10
Go version (client): go1.2.1
Git commit (client): dc9c28f/0.10.0
Server version: 0.10.0
Server API version: 1.10
Git commit (server): dc9c28f/0.10.0
Go version (server): go1.2.1
Last stable version: 0.10.0
[root@jmolet-vm2 client]# rpm -q docker-io
docker-io-0.10.0-2.el7.x86_64


How reproducible:
always?

Steps to Reproduce:
1. Get a docker image
2. Run a simple command on that image, eg: docker run mattdm/fedora /bin/bash -c "/bin/true"
3. compare the output of docker inspect on the resultant container, vs the container's config.json

Actual results:
# docker run mattdm/fedora /bin/bash -c "/bin/true"
# docker ps -a
CONTAINER ID        IMAGE                             COMMAND                CREATED             STATUS                      PORTS               NAMES
2da268ca628e        10.16.71.105:5000/fedora:latest   /bin/bash -c /bin/tr   13 seconds ago      Exited (0) 12 seconds ago                       grave_mcclintock    

# cat /var/lib/docker/containers/2da268ca628ed0e3ce55061ca9df5150844a411f33a2a94715652ab62c97ccc1/config.json | json_reformat | grep "NetworkSettings" -A 8
    "NetworkSettings": {
        "IPAddress": "172.17.0.2",
        "IPPrefixLen": 16,
        "Gateway": "172.17.42.1",
        "Bridge": "docker0",
        "PortMapping": null,
        "Ports": {

        }
# docker inspect 2da268ca628ed0e3 | json_reformat | grep "NetworkSettings" -A 7        "NetworkSettings": {
            "IPAddress": "",
            "IPPrefixLen": 0,
            "Gateway": "",
            "Bridge": "",
            "PortMapping": null,
            "Ports": null
        },

Expected results:
These two fields should be the same?

Additional info:

Comment 2 Daniel Walsh 2014-05-19 20:43:02 UTC
# docker inspect fbd36a9d7071 | json_reformat  | grep "NetworkSettings" -A8
        "NetworkSettings": {
            "IPAddress": "172.17.0.2",
            "IPPrefixLen": 16,
            "Gateway": "172.17.42.1",
            "Bridge": "docker0",
            "PortMapping": null,
            "Ports": {

            }
-bash-4.3# cat /var/lib/docker/containers/fbd36a9d707171bd20e0b0630c156f08e9b1ef4947fe0adef1d33e9f494ace68/config.json | json_reformat | grep "NetworkSettings" -A 8
    "NetworkSettings": {
        "IPAddress": "172.17.0.2",
        "IPPrefixLen": 16,
        "Gateway": "172.17.42.1",
        "Bridge": "docker0",
        "PortMapping": null,
        "Ports": {

        }

rpm -q docker-io
docker-io-0.11.1-3.fc21.x86_64

Seems to be fixed in -0.11.1-3

Comment 3 Chris Evich 2014-05-23 14:10:48 UTC
Clarification:  This bug is about inspect output on running vs. exited containers.  Essentially, the stopped container doesn't show the networking settings that were used when it was running.  This may be expected behavior, we just wanted to make sure it was documented if so.  Otherwise, it's definitely still broken:

[root@docker docker]# rpm -q docker
docker-0.11.1-5.el7.x86_64

[root@docker docker]# /usr/bin/docker -D run --name=4vMlGgNqFzyB image_blah_blah /bin/bash -c '/bin/true'
[debug] hijack.go:96 [hijack] End of stdout
[debug] commands.go:1958 End of CmdRun(), Waiting for hijack to finish.
[root@docker docker]# docker inspect 4vMlGgNqFzyB | grep "NetworkSettings" -A8
    "NetworkSettings": {
        "IPAddress": "",
        "IPPrefixLen": 0,
        "Gateway": "",
        "Bridge": "",
        "PortMapping": null,
        "Ports": null
    },
    "ResolvConfPath": "/etc/resolv.conf",

[root@docker docker]# /usr/bin/docker -D run --name running image_blah_blah /bin/bash -c 'sleep 1h'
...
[root@docker docker]# docker inspect running | grep "NetworkSettings" -A8
    "NetworkSettings": {
        "IPAddress": "172.17.0.11",
        "IPPrefixLen": 16,
        "Gateway": "172.17.42.1",
        "Bridge": "docker0",
        "PortMapping": null,
        "Ports": {}
    },
    "ResolvConfPath": "/etc/resolv.conf",

Comment 5 Chris Evich 2014-07-18 14:57:00 UTC
Confirmed fixed in 
docker-1.0.0-10.el7.x86_64
Client version: 1.0.0
Client API version: 1.12
Go version (client): go1.2.2
Git commit (client): 20fdb42/1.0.0
Server version: 1.0.0
Server API version: 1.12
Go version (server): go1.2.2
Git commit (server): 20fdb42/1.0.0

docker inspect of running container shows current values, as does /var/lib/docker/<cid>/config.json

docker inspect of stopped container shows current empty/null values as does /var/lib/docker/<cid>/config.json

Comment 7 errata-xmlrpc 2014-09-18 20:45:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1266.html