Container restart policies in docker-compose
- "no"
Never attempt to restart this container if it stops or crashes. It is embraced in quotes, otherwise it will be considered as "false"
- always
If this container stops "for any reason" automatically attempt to restart it
- on-failure
Only restart if the container stops with an error code
- unless-stopped
Always restart unless we (the developers) forcibly stop it
Example:
version: '3'
services:
redis-server:
image: 'redis'
node-app:
restart: always
build: .
ports:
- "4001:8081"