instruction: Create a Dockerfile for workloads
output: ```dockerfile
  from the postStart handler
  DiscussionKubernetes sends the postStart event immediately after the Container is created.
  There is no guarantee, however, that the postStart handler is called before
  the Container's entrypoint is called. The postStart handler runs asynchronously
  relative to the Container's code, but Kubernetes' management of the container
  blocks until the postStart handler completes. The Container's status is not
  set to RUNNING until the postStart handler completes.Kubernetes sends the preStop event immediately before the Container is terminated.
  Kubernetes' management of the Container blocks until the preStop handler completes,
  unless the Pod's grace period expires. For more details, see
  Pod Lifecycle.Note:Kubernetes only sends the preStop event when a Pod or a container in the Pod is terminated.
  This means that the preStop hook is not invoked when the Pod is completed.
  About this limitation, please see Container hooks for the detail.What's nextLearn more about Container lifecycle hooks.Learn more about the lifecycle of a Pod.ReferenceLifecycleContainerSee terminationGracePeriodSeconds in PodSpecFeedbackWas this page helpful?Yes
  NoThanks for the feedback. If you have a specific, answerable question about how to use Kubernetes, ask it on
  Stack Overflow.
  Open an issue in the GitHub Repository if you want to
  report a problem
  or
  suggest an improvement.Last modified August 24, 2023 at 6:38 PM PST: Use code_sample shortcode instead of code shortcode (e8b136c3b3)  Create child page
   Create an issue
   Print entire sectionBefore you beginDefine postStart and preStop handlersDiscussionWhat's nextReference© 2025 The Kubernetes Authors | Documentation Distributed under CC BY 4.0© 2025 The Linux Foundation ®. ```