How do I uninstall Docker Trusted Registry (DTR)?

941 views Asked by At

I had installed the DTR on a single manager, worker cluster (playing with it to get a better understanding before setting up a proper environment)

The DTR installation was successful. I wanted to uninstall the DTR and there were no issues in uninstalling it. The following command was used for the uninstall activity based on the docs.

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

Running a docker ps confirms that the containers associated with the DTR are no longer running.

However, when I login to UCP, I still see the old DTR and I don't see a way to delete it.

I am puzzled and unsure how to clean this up and create a new DTR.

UCP UI DTR Config

1

There are 1 answers

2
andov On

The docker/dtr destroy command, according to the DTR CLI usage documentation forcefully and in a non-blocking way removes the volumes and containers of an existing DTR replica.

Furthermore, as said on the Docker forum (https://forums.docker.com/t/uninstalling-dtr-doesnt-update-ucp-ui/31788/2), it seems to be an old issue of DTR.

How to fix it is summarized in one Docker Knowledge Base article. The steps reported there are the following:

  • Run the following commands to view your current UCP configuration file

    # 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
    
  • Edit the ucp-config.toml file and remove the [[registries]] section for the stale DTR entry/entries at the bottom of the file.

  • Run the following commands to create and apply the configuration from the file:

     # 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
    
  • Wait few seconds for the restarting ucp-agent.

  • Confirm that the stale DTR entries are removed on the UCP UI (Username > Admin Settings > Docker Trusted Registry) page.