simple:
image: busybox:latest
command: sh -c "echo hello && tail -f /dev/null"
another:
command: sh -c "sleep 0.5 && echo world && /bin/false"
restart: "on-failure:2"