That is how names are represented internally in Docker. See https://github.com/moby/moby/issues/6705 for some additional information. It just so happens the CLI for docker actually tends to strip the leading slash. But the real name includes that slash.
Effectively the docker module is returning the same info as `docker inspect` On Thu, Oct 12, 2017 at 3:11 PM, <[email protected]> wrote: > This task > > - name: start up target container > docker_container: > image: ubuntu:xenial > name: lab > hostname: testing-docker > pull: true > detach: yes > tty: yes > command: sleep infinity > state: started > published_ports: > - "8080:80" > - "8443:443" > register: > docker_results > > The docker_results > > "docker_results {'failed': False, u'changed': False, u'ansible_facts': > {u'docker_container': {u'Platform': u'linux', u'State': {u'Status': > u'running', u'Pid': 7086, u'OOMKilled': False, u'Dead': False, u'Paused': > False, u'Running': True, u'FinishedAt': u'2017-10-11T19:14:33.539397467Z', > u'Restarting': False, u'Error': u'', u'StartedAt': > u'2017-10-12T19:15:16.571403165Z', > u'ExitCode': 0}, u'Config': {u'Tty': True, u'Cmd': [u'sleep', u'infinity'], > u'Env': > [u'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'], > u'Domainname': u'', u'WorkingDir': u'', u'Image': u'ubuntu:xenial', > u'Hostname': u'testing-docker', u'StdinOnce': False, u'Labels': {}, > u'AttachStdin': False, u'User': u'', u'Volumes': None, u'ExposedPorts': > {u'443/tcp': {}, u'80/tcp': {}}, u'OnBuild': None, u'AttachStderr': False, > u'Entrypoint': None, u'AttachStdout': False, u'OpenStdin': False}, > u'ResolvConfPath': u'/var/lib/docker/containers/ > 6bfd77f74e0abf19a6589b38f513416c75c113a1d8ddc954577b7eadebca1265/resolv.conf', > u'HostsPath': u'/var/lib/docker/containers/6bfd77f74e0abf19a6589b38f51341 > 6c75c113a1d8ddc954577b7eadebca1265/hosts', u'Args': [u'infinity'], > u'Driver': u'overlay2', u'Path': u'sleep', u'HostnamePath': > u'/var/lib/docker/containers/6bfd77f74e0abf19a6589b38f51341 > 6c75c113a1d8ddc954577b7eadebca1265/hostname', u'RestartCount': 0, > u'Mounts': [], *u'Name': u'/lab'*, u'Created': > u'2017-10-11T18:33:35.434380798Z', > u'GraphDriver': {u'Data': {u'LowerDir': u'/var/lib/docker/overlay2/ > 7d8d66919eb5ad2f3c13740114f586b5293ecead2ebb8aebb3799347debc > 3f18-init/diff:/var/lib/docker/overlay2/78d7d5d36cef4ab7e18207cfbb20aa > bedcb35a96f3129fa6b23f109143e5e7c8/diff:/var/lib/docker/overlay2/ > c06f338659399ed32470652cde4524987a2f33031ead87bf46e740d4acd7 > a725/diff:/var/lib/docker/overlay2/d1f89d7c28a5e20e5fa9c8e13852ed > bf0fb26803f9433cf87b1366ad8cc7daa0/diff:/var/lib/docker/overlay2/ > 863242d926f70df96a673c48dfed2da051883f52ebf1951379010a1fb872 > 8666/diff:/var/lib/docker/overlay2/e9d37e4acc5ed8bfff2ade2b2e1675 > 2a7bf3dccf0533466b1427c48831173f13/diff', u'WorkDir': > u'/var/lib/docker/overlay2/7d8d66919eb5ad2f3c13740114f586 > b5293ecead2ebb8aebb3799347debc3f18/work', u'MergedDir': > u'/var/lib/docker/overlay2/7d8d66919eb5ad2f3c13740114f586 > b5293ecead2ebb8aebb3799347debc3f18/merged', u'UpperDir': > u'/var/lib/docker/overlay2/7d8d66919eb5ad2f3c13740114f586 > b5293ecead2ebb8aebb3799347debc3f18/diff'}, u'Name': u'overlay2'}, > u'ExecIDs': None, u'ProcessLabel': u'', u'NetworkSettings': > {u'SecondaryIPAddresses': None, u'SecondaryIPv6Addresses': None, u'Bridge': > u'', u'GlobalIPv6PrefixLen': 0, u'LinkLocalIPv6Address': u'', > u'MacAddress': u'02:42:ac:11:00:02', u'IPAddress': u'172.17.0.2', > u'HairpinMode': False, u'IPPrefixLen': 16, u'GlobalIPv6Address': u'', > u'Gateway': u'172.17.0.1', u'LinkLocalIPv6PrefixLen': 0, u'EndpointID': u' > b7fa5feeb8b9c0c77d49d470661e47dbaa1faf68b2b0d55a13786d90edde1e71', > u'SandboxKey': u'/var/run/docker/netns/7d41f83b4bfe', u'SandboxID': u' > 7d41f83b4bfe13f0e0534c3ace5a58e71ab2a7c2615bd6394d6ebb7935756ad4', > u'IPv6Gateway': u'', u'Networks': {u'bridge': {u'NetworkID': u' > 03d6900e0ffea5652ebc2f209be380aad2e554239bb9aac044b5b7fdf698595b', > u'MacAddress': u'02:42:ac:11:00:02', u'GlobalIPv6PrefixLen': 0, u'Links': > None, u'GlobalIPv6Address': u'', u'IPAddress': u'172.17.0.2', > u'DriverOpts': None, u'IPPrefixLen': 16, u'EndpointID': u' > b7fa5feeb8b9c0c77d49d470661e47dbaa1faf68b2b0d55a13786d90edde1e71', > u'Aliases': None, u'IPv6Gateway': u'', u'Gateway': u'172.17.0.1', > u'IPAMConfig': None}}, u'Ports': {u'443/tcp': [{u'HostPort': u'8443', > u'HostIp': u'0.0.0.0'}], u'80/tcp': [{u'HostPort': u'8080', u'HostIp': > u'0.0.0.0'}]}}, u'AppArmorProfile': u'docker-default', u'Image': u'sha256: > 747cb2d60bbecbda48aff14a8be5c8b913ca69318a6067e57c697f8a78dda06e', > u'LogPath': u'/var/lib/docker/containers/6bfd77f74e0abf19a6589b38f51341 > 6c75c113a1d8ddc954577b7eadebca1265/6bfd77f74e0abf19a6589b38f51341 > 6c75c113a1d8ddc954577b7eadebca1265-json.log', u'HostConfig': > {u'CpuPeriod': 0, u'MemorySwappiness': None, u'AutoRemove': False, > u'Cgroup': u'', u'PortBindings': {u'443/tcp': [{u'HostPort': u'8443', > u'HostIp': u'0.0.0.0'}], u'80/tcp': [{u'HostPort': u'8080', u'HostIp': > u'0.0.0.0'}]}, u'BlkioDeviceReadIOps': None, u'CpuQuota': 0, u'UsernsMode': > u'', u'ConsoleSize': [0, 0], u'Dns': [], u'Memory': 0, u'PidsLimit': 0, > u'DnsSearch': [], u'Privileged': False, u'IOMaximumIOps': 0, u'NanoCpus': > 0, u'CpusetCpus': u'', u'PidMode': u'', u'DiskQuota': 0, u'CgroupParent': > u'', u'BlkioWeight': 0, u'MemorySwap': 0, u'RestartPolicy': > {u'MaximumRetryCount': 0, u'Name': u''}, u'OomScoreAdj': 0, > u'BlkioDeviceReadBps': None, u'VolumeDriver': u'', u'ReadonlyRootfs': > False, u'CpuShares': 0, u'PublishAllPorts': False, u'MemoryReservation': 0, > u'BlkioWeightDevice': None, u'CpuPercent': 0, u'NetworkMode': u'default', > u'BlkioDeviceWriteBps': None, u'Isolation': u'', u'GroupAdd': None, > u'CpuRealtimeRuntime': 0, u'Devices': None, u'BlkioDeviceWriteIOps': None, > u'VolumesFrom': None, u'Binds': [], u'CpusetMems': u'', u'KernelMemory': 0, > u'UTSMode': u'', u'ExtraHosts': None, u'Runtime': u'runc', u'Ulimits': > None, u'CapDrop': None, u'DnsOptions': [], u'Links': None, u'ShmSize': > 67108864, u'CpuRealtimePeriod': 0, u'IpcMode': u'shareable', > u'ContainerIDFile': u'', u'SecurityOpt': None, u'CapAdd': None, > u'CpuCount': 0, u'DeviceCgroupRules': None, u'OomKillDisable': False, > u'LogConfig': {u'Type': u'json-file', u'Config': {}}, > u'IOMaximumBandwidth': 0}, u'Id': u'6bfd77f74e0abf19a6589b38f51341 > 6c75c113a1d8ddc954577b7eadebca1265', u'MountLabel': u''}}}" > > I expected the Name: to be lab, why is called "/lab" (note the forward > slash). > > Thanks. > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/ansible-project/6d603dd5-780d-4c64-8205-88f2ff96b2b9%40googlegroups. > com > <https://groups.google.com/d/msgid/ansible-project/6d603dd5-780d-4c64-8205-88f2ff96b2b9%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Matt Martz @sivel sivel.net -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v_ROXchi2zNEKOn5XO4L5wXKvmKjhJ4mKJf5ysvObVqww%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
