docker / docker/docker-py

container.status not updated after .run

Open
#2,860 2 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

Tested under:

Python 3.8.5 (Ubuntu)
Docker version 20.10.7, build f0df350
docker 5.0.0

After running simple code:

docker_client = docker.from_env()
docker_container = docker_client.containers.run( image, detach=True )

docker_container.status is always equals created. I haven't seen status == "running".

To get actual status I have to use the cumbersome code (as suggested on stackoverflow half a year ago):

docker_client.containers.get( docker_container.id ).status

BTW, documentation on status doesn't mention some statuses, which are: created, restarting, running, removing, paused, exited, or dead

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 by reproducing the issue with docker.from_env() and containers.run(..., detach=True), then compare the returned container's status with containers.get(container.id).status. Check the container status documentation and determine whether the returned object should refresh automatically; done means the intended status behavior is covered and the documented status values are accurate.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.