0

我已将 DTR 安装在单个管理器、工作集群上(在设置适当的环境之前使用它以获得更好的理解)

DTR 安装成功。我想卸载 DTR,卸载它没有问题。以下命令用于基于文档的卸载活动。

docker run -it --rm \
>   docker/dtr:2.5.3 destroy \
>   --ucp-insecure-tls

运行 docker ps 确认与 DTR 关联的容器不再运行。

但是,当我登录 UCP 时,我仍然看到旧的 DTR,而且我看不到删除它的方法。

我很困惑,不确定如何清理它并创建一个新的 DTR。

UCP UI DTR 配置

4

1 回答 1

2

根据DTR CLI 使用文档, docker/dtr destroy命令以非阻塞方式强制删除现有 DTR 副本的卷和容器。

此外,正如 Docker 论坛 ( https://forums.docker.com/t/uninstalling-dtr-doesnt-update-ucp-ui/31788/2 ) 上所说,这似乎是 DTR 的一个老问题。

如何修复它在一篇 Docker 知识库文章中进行了总结。报告的步骤如下:

  • 运行以下命令查看您当前的 UCP 配置文件

    # CURRENT_CONFIG_NAME will be the name of the currently active UCP configuration
    CURRENT_CONFIG_NAME=$(docker service inspect ucp-agent --format '{{range .Spec.TaskTemplate.ContainerSpec.Configs}}{{if eq "/etc/ucp/ucp.toml" .File.Name}}{{.ConfigName}}{{end}}{{end}}')
    
    # Collect the current config with `docker config inspect`
    docker config inspect --format '{{ printf "%s" .Spec.Data }}' $CURRENT_CONFIG_NAME > ucp-config.toml
    
  • 编辑 ucp-config.toml 文件并删除文件底部陈旧 DTR 条目的 [[registries]] 部分。

  • 运行以下命令以从文件中创建和应用配置:

     # NEXT_CONFIG_NAME will be the name of the new UCP configuration
     NEXT_CONFIG_NAME=${CURRENT_CONFIG_NAME%%-*}-$((${CURRENT_CONFIG_NAME##*-}+1))
    
     # Create the new swarm configuration from the file ucp-config.toml
     docker config create $NEXT_CONFIG_NAME ucp-config.toml
    
     # Use the `docker service update` command to remove the current configuration and apply the new configuration to the `ucp-agent` service.
     docker service update --config-rm $CURRENT_CONFIG_NAME --config-add source=$NEXT_CONFIG_NAME,target=/etc/ucp/ucp.toml ucp-agent
    
  • 等待几秒钟以重新启动ucp-agent

  • 确认已在 UCP UI(用户名 > 管理设置 > Docker 受信任的注册表)页面上删除了过时的 DTR 条目。

于 2018-10-12T19:45:45.677 回答