Skip to content

Delete stale containerd object on start failure#38364

Merged
cpuguy83 merged 1 commit intomoby:masterfrom
cpuguy83:fix_stale_container_on_start
Feb 14, 2019
Merged

Delete stale containerd object on start failure#38364
cpuguy83 merged 1 commit intomoby:masterfrom
cpuguy83:fix_stale_container_on_start

Conversation

@cpuguy83
Copy link
Copy Markdown
Member

containerd has two objects with regard to containers.
There is a "container" object which is metadata and a "task" which is
manging the actual runtime state.

When docker starts a container, it creartes both the container metadata
and the task at the same time. So when a container exits, docker deletes
both of these objects as well.

This ensures that if, on start, when we go to create the container metadata object
in containerd, if there is an error due to a name conflict that we go
ahead and clean that up and try again.

Fixes #38346

@thaJeztah
Copy link
Copy Markdown
Member

ping @mlaventure @crosbymichael @tonistiigi PTAL

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 19, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@818d2dd). Click here to learn what that means.
The diff coverage is 0%.

@@            Coverage Diff            @@
##             master   #38364   +/-   ##
=========================================
  Coverage          ?   36.54%           
=========================================
  Files             ?      610           
  Lines             ?    45404           
  Branches          ?        0           
=========================================
  Hits              ?    16591           
  Misses            ?    26518           
  Partials          ?     2295

Copy link
Copy Markdown
Contributor

@mlaventure mlaventure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

containerd has two objects with regard to containers.
There is a "container" object which is metadata and a "task" which is
manging the actual runtime state.

When docker starts a container, it creartes both the container metadata
and the task at the same time. So when a container exits, docker deletes
both of these objects as well.

This ensures that if, on start, when we go to create the container metadata object
in containerd, if there is an error due to a name conflict that we go
ahead and clean that up and try again.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@alexanderadam
Copy link
Copy Markdown

Should this fix the message id already in use when trying to restart containers, too?
If so, should it be fixed in Docker version 19.03.6, build 369ce74a3c?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker start <container_name> returns "id already in use"

7 participants