Hide Forgot
Description of problem: rebase python-docker-py to v1.8.0
created container can't be displayed by python APIs for docker. # rpm -q python-docker-py python-docker-py-1.9.0-1.el7.noarch [root@hp-dl360g9-04 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/busybox latest 2b8fd9751c4c 3 months ago 1.093 MB registry.access.redhat.com/rhel7 latest 1a9b3357bac5 6 months ago 203.3 MB [root@hp-dl360g9-04 ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES [root@hp-dl360g9-04 ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES [root@hp-dl360g9-04 ~]# python Python 2.7.5 (default, Oct 11 2015, 17:47:16) [GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from docker import client >>> cli = client.Client(base_url='unix://var/run/docker.sock') >>> containers = cli.containers() >>> containers [] >>> images = cli.images() >>> images [{u'Created': 1466724217, u'Labels': {}, u'VirtualSize': 1092588, u'ParentId': u'', u'RepoTags': [u'docker.io/busybox:latest'], u'RepoDigests': None, u'Id': u'sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749', u'Size': 1092588}, {u'Created': 1458660173, u'Labels': {u'Vendor': u'Red Hat, Inc.', u'Name': u'rhel7/rhel', u'Build_Host': u'rcm-img03.build.eng.bos.redhat.com', u'Version': u'7.2', u'Architecture': u'x86_64', u'Release': u'56', u'BZComponent': u'rhel-server-docker', u'Authoritative_Registry': u'registry.access.redhat.com'}, u'VirtualSize': 203268847, u'ParentId': u'', u'RepoTags': [u'registry.access.redhat.com/rhel7:latest'], u'RepoDigests': None, u'Id': u'sha256:1a9b3357bac5468b34b441eb7fe90ab4789a9e2d0f721c62141eb7926fcb4562', u'Size': 203268847}] >>> first_image = images[0]['RepoTags'][0] >>> first_image u'docker.io/busybox:latest' >>> container = cli.create_container(image=first_image, command='/bin/sleep 30') >>> cli.containers() [] >>> cli.containers() []
Tomas, could you please take a look at this one?
Alex, `containers` method is equivalent of `ps` command in docker client. So when you create a container, you need to start it in order to see the container with `containers` call, or you can set `all=True` to see even stopped containers. ``` In [1]: d.create_container("fedora:24", command="cat", stdin_open=True) Out[1]: {'Id': '03f21097be111032faeb6b5e663cb21759935cab991a1e5f739f1c07732a721e', 'Warnings': None} In [2]: d.start("03f21097be111032faeb6b5e663cb21759935cab991a1e5f739f1c07732a721e") In [3]: d.containers() Out[3]: [{'Command': 'cat', 'Created': 1474632902, 'HostConfig': {'NetworkMode': 'default'}, 'Id': '03f21097be111032faeb6b5e663cb21759935cab991a1e5f739f1c07732a721e', 'Image': 'fedora:24', 'ImageID': 'sha256:f9873d530588316311ac1d3d15e95487b947f5d8b560e72bdd6eb73a7831b2c4', 'Labels': {}, 'Mounts': [], 'Names': ['/serene_poitras'], 'NetworkSettings': {'Networks': {'bridge': {'Aliases': None, 'EndpointID': 'ee0c93b6f264313f544f462e138a3ca1c19ec6ff7c19378f0e7ba2bb5885cbed', 'Gateway': '172.17.0.1', 'GlobalIPv6Address': '', 'GlobalIPv6PrefixLen': 0, 'IPAMConfig': None, 'IPAddress': '172.17.0.2', 'IPPrefixLen': 16, 'IPv6Gateway': '', 'Links': None, 'MacAddress': '02:42:ac:11:00:02', 'NetworkID': '7815c42fddb90dd68f68be9492108368c08ee943a96561276fc95514fe372fde'}}}, 'Ports': [], 'State': 'running', 'Status': 'Up 7 seconds'}] ```
(In reply to Tomas Tomecek from comment #5) > Alex, `containers` method is equivalent of `ps` command in docker client. > Tomas, I see, but I just created a container by python API and keep the container running 30s, but I can't find it in list of running containers. >>> container = cli.create_container(image=first_image, command='/bin/sleep 30') >>> cli.containers() [] > So when you create a container, you need to start it in order to see the > container with `containers` call, or you can set `all=True` to see even > stopped containers. I only wanna show running containers. > > ``` > In [1]: d.create_container("fedora:24", command="cat", stdin_open=True) > Out[1]: > {'Id': '03f21097be111032faeb6b5e663cb21759935cab991a1e5f739f1c07732a721e', > 'Warnings': None} > > In [2]: > d.start("03f21097be111032faeb6b5e663cb21759935cab991a1e5f739f1c07732a721e") > > In [3]: d.containers() In here, I can't see any running containers, please see above comments, thanks
(In reply to Alex Jia from comment #6) > In here, I can't see any running containers, please see above comments, > thanks Because you haven't started it. `create_container` just creates a container and does NOT start it. You have to explicitly start it with `start` method. Take a look at my example.
(In reply to Tomas Tomecek from comment #7) > (In reply to Alex Jia from comment #6) > > In here, I can't see any running containers, please see above comments, > > thanks > > Because you haven't started it. `create_container` just creates a container > and does NOT start it. You have to explicitly start it with `start` method. > Take a look at my example. Oh, I lost the steps, thanks a lot.
Due to an old version of python-backports-ssl_match_hostname this build of python-docker-py is not able to accept SSL certificates which have ip address in SubjectAlthostname. I'm assuming upstream needs this for docker machine. Creating bug to track this: https://bugzilla.redhat.com/show_bug.cgi?id=1379594
What is this status of this? What version of python-docker-py will be provided in RHEL 7.3. Should we consolidate these BZ's? 1374057 & 1374058 Customer participating in RHEL 7.3 HTB is asking for this package to be updated/rebased for 7.3.
*** Bug 1374057 has been marked as a duplicate of this bug. ***
(In reply to Terry Bowling from comment #10) > What is this status of this? Will be shipped in RHEL 7.3.0. See advisory link in Comment 1. > > What version of python-docker-py will be provided in RHEL 7.3. 1.9.0. I updated bz summary to reflect that change. > > Should we consolidate these BZ's? 1374057 & 1374058 No idea why the duplicates occurred. Guess bugzilla was acting funny on my browser. Closing Bug 1374057 in favor of this. > > Customer participating in RHEL 7.3 HTB is asking for this package to be > updated/rebased for 7.3.
Thanks Lokesh for the clarification. Removing needinfo as I would provide the same info.
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. https://rhn.redhat.com/errata/RHBA-2016-2629.html