Skip to main content

Docker Success Center

The Docker enterprise customer portal.

Docker, Inc.

Querying the results of a garbage collection (GC) job

There are times where Docker support need to review the outcome of a previous Garbage Collection job. It can be used to verify orphaned data (to some extent), stale tags, manifests, etc. This article will show you how to query the results of the last completed GC job.

Prerequisites

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

Steps

To effectively query garbage collection data please see the commands below. Be sure to replace the following with the values for your configuration:

  • DTR_URL="dtr.example.com" (Use your DTR URL)
  • USERNAME="username"
  • PASSWORD="password"
  • JOB_TYPE="job_type" (See link below for list of Job Types)

List of job types: https://docs.docker.com/datacenter/d...obs/#job-types

### job logs
# get last job details
curl -ks -X GET --header "Accept: application/json" -u ${USERNAME}:${PASSWORD} "https://${DTR_URL}/api/v0/jobs?action=${JOB_TYPE}&worker=any&running=any&start=0" | jq -r .jobs[0]

# get job job id from the last ${JOB_TYPE} job and send that to get the job logs curl -ks -X GET --header "Accept: application/json" -u ${USERNAME}:${PASSWORD} "https://${DTR_URL}/api/v0/jobs/$(curl -ks -X GET --header "Accept: application/json" -u ${USERNAME}:${PASSWORD} "https://${DTR_URL}/api/v0/jobs?action=${JOB_TYPE}&worker=any&running=any&start=0" | jq -r .jobs[0].id)/logs" | jq -r .[].Data
  • Was this article helpful?