Skip to content

Bug or Misleading Docu: All docker images will be downloaded when the image tag is not specified #2545

@bonacci-johannes

Description

@bonacci-johannes

BUG
Setup: Python3.8: docker 4.2.0

When starting a clean postgres container using python docker sdk the docker sdk pulls all postgres images.

It would be helpful to update the docu mentioning that the version tag should be specified.
Or even more handy, introduce a default to the latest version?

Here is the code:

import docker
from docker.models.containers import Container
client = docker.from_env()
container: Container = client.containers.run(
    image='postgres', remove=True, auto_remove=True, detach=True,
    ports={'5432': '5432'},
    environment=
    [
        'POSTGRES_PASSWORD=pwd',
        'POSTGRES_USER=test',
        'POSTGRES_DB=test'
    ])

Bash output of 'docker images' before running the code:

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

Bash output of 'docker images' after running the code:

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
postgres            10.12               1fb929c54703        7 days ago          200MB
postgres            10-alpine           1bd67b33a51c        2 weeks ago         70.3MB
postgres            10.12-alpine        1bd67b33a51c        2 weeks ago         70.3MB
postgres            10.11               5fea18bb7e20        2 months ago        250MB
postgres            10.11-alpine        fb495265b81f        2 months ago        72.4MB
postgres            10.10-alpine        a071f71cc9bb        5 months ago        71.8MB
postgres            10.10               9a05a2b9e69f        5 months ago        211MB
postgres            10.2-alpine         400ef39e0dbf        2 years ago         39.5MB
...
...
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions