apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: ams-task
spec:
  schedule: "* * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          imagePullSecrets:
          - name: aliyuncs-registry
          containers:
          - name: ams-task
            image: laravel:latest
            command: ["/usr/local/bin/php","/var/www/html/artisan","schedule:run"]
            imagePullPolicy: Always
          restartPolicy: OnFailure
  successfulJobsHistoryLimit: 1

docker-compose定时任务处理

* * * * * cd /www/wwwroot/ams-task&&/usr/bin/docker-compose exec -T ams-task  php /var/www/html/artisan schedule:run
最后修改:2022 年 08 月 01 日 08 : 58 AM
如果觉得我的文章对你有用,请随意赞赏