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

如何重建Docker容器以恢复损坏的alerta.conf配置文件?

解决方案

方法一:直接从镜像恢复配置文件(无需删除容器)

如果不想删除现有容器,可直接从官方镜像中复制默认的alerta.conf文件到损坏的容器中:

  1. 执行命令复制默认配置文件:
    sudo docker cp alerta/alerta-web:/app/alerta.conf 0c24c2e72716:/app/alerta.conf
    
  2. 重启容器使配置生效:
    sudo docker restart 0c24c2e72716
    

方法二:重建全新容器(彻底重置)

如果需要完全忽略之前的修改,创建全新容器:

  1. 停止并删除当前损坏的容器:
    sudo docker stop 0c24c2e72716
    sudo docker rm 0c24c2e72716
    
  2. 拉取最新的官方alerta-web镜像:
    sudo docker pull alerta/alerta-web
    
  3. 用官方镜像重新启动容器(如果之前有自定义的端口映射、环境变量等,需补充到命令中,示例基础启动命令):
    sudo docker run -d --name alerta-web -p 8080:8080 alerta/alerta-web
    

关于之前的docker build错误说明

你执行的sudo docker build --no-cache alerta/alerta-web命令有误:docker build是用于从本地Dockerfile和上下文目录构建新镜像,而非直接使用现有镜像名作为路径。如果需要更新镜像,使用docker pull命令即可。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.09 15:50:26