Skip to content

Fix examples for Compose lifecycle hooks #24853

@andriibratanin

Description

@andriibratanin

Is this a docs issue?

  • My issue is about the documentation content or website

Type of issue

Information is incorrect

Description

The doc describing the lifecycle provides completely irrelevant examples.

The post-start hook cannot be used to fix a volume permissions because there is no guarantee that it will finish before a containerized application starts.

The pre-stop hook example offers to use it for flushing caches. Taking into account that "these hooks won't run if the container stops by itself or gets killed suddenly", it doesn't make sense to flush caches in the hook because: 1) if a "normal" container stop is ok, then caches are already flushed by a containerized application; 2) if the container gets killed, then the hook will be skipped anyway.

These inaccuracies make the lifecycle feature look like doubtful...

Thank you!

Location

https://docs.docker.com/compose/how-tos/lifecycle/

Suggestion

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/composeRelates to docker-compose.yml spec or docker-compose binary

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions