0 0 Share PDF

Multiple DTRs shown on UCP 2.2 & 3.0.x when only one or none exists

Article ID: KB000405

Issue

On your UCP UI, you may find stale DTR entries under Admin Settings > Docker Trusted Registry page. This article explains how you can remove those stale DTR entries from the UCP UI through the command line.

Prerequisites

Before performing these steps, you must meet the following requirements:

  • Universal Control Plane 3.0.x
  • Universal Control Plane 2.2.x
  • Docker EE 17.06 and higher

For UCP 2.1 or 2.0, see Multiple DTRs shown when only one exists.

Resolution

Perform the following steps using the UCP configuration file to remove the stale DTR entry/entries:

  1. 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
    
  2. Edit the ucp-config.toml file and remove the [[registries]] section(https://success.docker.com/api/asset/.%2Fmultiple-dtrs-shown-on-ucp-22-when-only-one-or-none-exists%2Fs) for the stale DTR entry/entries at the bottom of the file. If you wish to remove all DTR entries from the UCP UI, your ucp-config.toml file should end with something similiar to the following:

    [trust_configuration]
    require_content_trust = false
    
  3. 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
    

    After a few seconds, you should notice that a new ucp-agent is spun up.

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