You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

将Docker镜像部署至Heroku时遭遇Error R10启动超时问题

解决Heroku部署selenium/standalone-chrome的R10超时错误

出现Error R10 (Boot timeout)的核心原因是Heroku要求web进程必须在60秒内绑定到它动态分配的$PORT环境变量指定的端口,而默认的selenium官方镜像没有适配这个规则。以下是具体解决步骤:

  • 修改启动命令,绑定到$PORT
    默认的selenium/standalone-chrome固定使用4444端口,你需要修改启动参数让它绑定到Heroku提供的$PORT。可以通过自定义Dockerfile实现:

    FROM selenium/standalone-chrome:latest
    CMD ["/opt/bin/start-selenium-server.sh", "-port", "$PORT"]
    

    或者在推送镜像到Heroku时,通过Heroku CLI指定启动命令:

    heroku container:push web --app your-app-name
    heroku container:release web --app your-app-name --command "/opt/bin/start-selenium-server.sh -port \$PORT"
    
  • 确认进程类型配置
    Heroku默认将容器识别为web进程,若你的selenium服务仅作内部使用无需对外暴露,可以将进程类型改为worker(worker进程无需绑定端口):

    heroku ps:scale web=0 worker=1 --app your-app-name
    

    若需要外部访问selenium服务,则保持web类型,确保端口绑定正确。

  • 排查启动细节
    用命令查看实时启动日志,确认selenium服务是否成功绑定端口,或是否存在其他启动异常:

    heroku logs --tail --app your-app-name
    
  • 本地模拟验证
    在本地模拟Heroku环境测试端口绑定是否正常:

    docker run -e PORT=5000 -p 5000:5000 selenium/standalone-chrome /opt/bin/start-selenium-server.sh -port 5000
    

    访问http://localhost:5000/wd/hub,若能看到selenium的服务页面,说明端口配置有效。

内容的提问来源于stack exchange,提问作者Marvin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 09:42:23