Docker 快速入门

优质
小牛编辑
151浏览
2023-12-01

mysql 作为storage的docker镜像,下面一行命令就启动一个job调度器

docker run -d -v $(pwd)/hangfire:/publish/hangfire -e HangfireMysqlConnectionString='Server=172.17.0.2;Port=3306;Database=hangfire;Uid=root;Pwd=123456;charset=utf8;SslMode=none;Allow User Variables=True' -e HangfireMail_Server='' -e HangfireMail_Port='' -e HangfireMail_UseSsl='True' -e HangfireMail_User='' -e HangfireMail_Password='' -e HangfireQueues='default,apis,recurring' -e DefaultRecurringQueueName='recurring' -e HangfireUserName='test' -e HangfirePwd='123456' -e Lang='zh' -p 80:5000 --name hangfire nainaigu/mysqlhangfire:20200928234416

【推荐】Redis作为storage的docker镜像,下面一行命令就启动一个job调度器

docker run -d -v $(pwd)/hangfire:/publish/hangfire -e HangfireRedisConnectionString='172.17.0.4:6379' -e HangfireMail_Server='' -e HangfireMail_Port='' -e HangfireMail_UseSsl='True' -e HangfireMail_User='' -e HangfireMail_Password='' -e HangfireQueues='default,apis,recurring' -e DefaultRecurringQueueName='recurring' -e HangfireUserName='test' -e HangfirePwd='123456' -e Lang='zh' -p 80:5000 --name hangfire nainaigu/redishangfire:20200928234709

参数说明

  • HangfireRedisConnectionString:redis连接字符串 必填【要确保在docker容器内可以访问到】
  • HangfireMysqlConnectionString:mysql连接字符串 必填【要确保在docker容器内可以访问到】
  • HangfireMail_Server: 选填 配置发送邮件
  • HangfireMail_Port: 选填 配置发送邮件
  • HangfireMail_UseSsl: 选填 配置发送邮件
  • HangfireMail_User: 选填 配置发送邮件
  • HangfireMail_Password: 选填 配置发送邮件
  • HangfireQueues: 必填 设置队列名称 多个用逗号隔开
  • DefaultRecurringQueueName: 必填 默认周期性job的执行队列
  • HangfireUserName: 选填 hangfire 面板的 登录账号
  • HangfirePwd: 选填 hangfire 面板的 登录密码
  • Lang: 选填 中文的话请设值zh