Docker Compose provides various restart options to control how your containers behave when they exit. Here's a breakdown of each option:

  1. 'no': This is the default option. It means the container will not be restarted after it exits.
  2. 'always': With this option, the container will always restart whenever it exits, regardless of the exit code.
  3. 'on-failure': The container will only be restarted if it exits with a non-zero status code. This is useful for restarting containers that crash or encounter errors.
  4. 'unless-stopped': This option ensures the container will always restart unless it's explicitly stopped manually. This is helpful for services that should be constantly running.
Docker Compose Restart Options Explained

原文地址: https://www.cveoy.top/t/topic/nZOd 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录