docker / docker-py

A Python library for the Docker Engine API

Home Page:https://docker-py.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When using docker.containers.run with labels={...} we have containers left over

rrauenza opened this issue · comments

I can't reproduce this with the CLI.

When adding labels= to my containers.run() api call, I get leftover garbage:

CONTAINER ID   IMAGE           COMMAND                  CREATED              STATUS                     PORTS     NAMES
9f6eaa552464   5782210c54f7    "/bin/sh -c '#(nop) …"   About a minute ago   Created                              modest_kapitsa
c4bbe10ddd9c   1213308453bf    "/bin/sh -c '#(nop) …"   About a minute ago   Created                              hopeful_hugle
cb39a98e61cc   752c9c88f1f6    "/bin/sh -c '#(nop) …"   About a minute ago   Created                              gracious_chaum
16a5f4809f72   c0afa25eb285    "/bin/sh -c '#(nop) …"   About a minute ago   Created                              laughing_davinci
27468479143e   ade62a75afbe    "/bin/sh -c '#(nop) …"   About a minute ago   Created                              determined_roentgen
6c7b78e7088a   bc69b8ba557c    "/bin/sh -c '#(nop) …"   About a minute ago   Created                              elegant_brattain
f3d7f1236882   2ba61f23bf1d    "/bin/sh -c '#(nop) …"   About a minute ago   Created                              determined_bouman
f4ff34758844   1050cb501124    "/bin/sh -c '#(nop) …"   About a minute ago   Created                              xenodochial_liskov
f5a45c22a50b   27ce0b23496b    "/bin/sh -c '#(nop) …"   About a minute ago   Created                              festive_noether
1c9cafb296c8   0a50e1127049    "/bin/sh -c '#(nop) …"   About a minute ago   Created                              clever_agnesi
192413a9f17e   5782210c54f7    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              elastic_engelbart
a7f96975cf01   05aa80e7137e    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              sleepy_albattani
3ade268801d0   1213308453bf    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              objective_ishizaka
889b802bc6b6   326fdb86c9db    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              heuristic_khorana
bb439597726c   752c9c88f1f6    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              relaxed_shannon
5521407fb679   249e19c45472    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              tender_allen
9539d5454ab1   c0afa25eb285    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              elastic_fermat
19f1f06e20c0   53507cdaca7e    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              fervent_yalow
7810bc30a9ca   ade62a75afbe    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              silly_keldysh
d3d3e56c76b6   7e2759f47909    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              unruffled_zhukovsky
a74a7f5a43d1   bc69b8ba557c    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              zen_cartwright
7f3fafa1702a   1e280da7f89d    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              vigilant_montalcini
8e32d22de81c   2ba61f23bf1d    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              kind_almeida
660fac886ad8   16796573151d    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              inspiring_pascal
2943a1c2a2b4   1050cb501124    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              ecstatic_black
8e508f5d4934   859683336f00    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              practical_kare
70399c44f617   27ce0b23496b    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              inspiring_torvalds
e3302e05dfb6   1af07054376f    "/bin/sh -c '#(nop) …"   5 minutes ago        Created                              silly_ramanujan

But if I leave off labels, I don't get these. Here is an inspect:

[
    {
        "Id": "9f6eaa5524644d2e687cf443b8af55e09fcc9251915ee1933736a1d9f650f380",
        "Created": "2024-03-11T18:11:47.824987441Z",
        "Path": "/bin/sh",
        "Args": [
            "-c",
            "#(nop) ",
            "LABEL myspeciallabel=foo"
        ],

I think somewhere when the label is applied, the equivalent of --rm isn't being passed when these noop containers are being made/run to assign the label? But doesn't the CLI use similar API's?