Skip to content

container: allow an empty --cidfile path from mktemp - #7239

Open
locker95 wants to merge 1 commit into
docker:masterfrom
locker95:fix/cidfile-allow-empty-mktemp
Open

container: allow an empty --cidfile path from mktemp#7239
locker95 wants to merge 1 commit into
docker:masterfrom
locker95:fix/cidfile-allow-empty-mktemp

Conversation

@locker95

Copy link
Copy Markdown

--cidfile currently errors if the path already exists, even when the file is empty.

that's a pain with mktemp, which creates the file first:

t=$(mktemp)
docker run --rm --cidfile=$t debian

only refuse the path if it already has content (another container's id). empty files get reused.

Fixes #5954

newCIDFile currently errors if the path already exists, even when the
file is empty. mktemp creates that empty file first, so
`docker run --cidfile=$(mktemp)` always fails.

Keep refusing a path that already holds a container ID. Open/create
otherwise so an empty file can be reused.

Fixes docker#5954

Signed-off-by: Dean Chen <862469039@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--cidfile fails if file exists even if empty

1 participant