docker / docker/docker-py

not pull latest images only with client.containers.run("ubuntu", "echo hello world")

Open
#2,603 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

I am new for this package docker, and use the package first time:

client = docker.from_env()
client.containers.run("ubuntu", "echo hello world")

it takes time forever. Then I checked and discovered what happen.

$ docker images |grep ubuntu
ubuntu                                    16.04               330ae480cb85        8 days ago          125MB
ubuntu                                    14.04.5             132b7427a3b4        3 years ago         188MB
ubuntu                                    12.04               5b117edd0b76        3 years ago         104MB
ubuntu                                    12.04.5             5b117edd0b76        3 years ago         104MB
ubuntu                                    14.04.4             0ccb13bf1954        3 years ago         188MB
ubuntu                                    14.04.3             3876b81b5a81        4 years ago         188MB
ubuntu                                    14.04.2             44ae5d2a191e        4 years ago         188MB
ubuntu                                    14.04.1             ab1bd63e0321        5 years ago         188MB
ubuntu                                    12.10               3e314f95dcac        6 years ago         172MB
ubuntu                                    13.04               a58cd502f927        6 years ago         169MB
ubuntu                                    13.10               7f020f7bf345        6 years ago         185MB
ubuntu                                    10.04               e21dbcc7c9de        6 years ago         **183MB

Seems without image tag provided, above client.containers.run() would not use tag latest as default tag, then try to pull all ubuntu images, that becomes endless job.

I have to adjust the command to

client.containers.run("ubuntu:16.04", "echo hello world")

So could we update the code to accept latest as default tag if no tag provide?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the client.containers.run entry point and trace how the image name is passed to Docker when no tag is provided. Reproduce the command with an untagged ubuntu image and compare it with ubuntu:16.04; done means the untagged form has the expected default-tag behavior without attempting unnecessary image pulls.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.