Skip to content

Instantly share code, notes, and snippets.

@sujaypillai
Last active March 6, 2019 17:37
Show Gist options
  • Select an option

  • Save sujaypillai/e27d502a666597ffa1441121d0ac5944 to your computer and use it in GitHub Desktop.

Select an option

Save sujaypillai/e27d502a666597ffa1441121d0ac5944 to your computer and use it in GitHub Desktop.
DTR_Mirroring_API
$export TOKEN=52855d2f-13d6-44d8-aca3-8a89b8d63b71
//Create a repository named hub/golang in your DTR
$curl -u sujaypillai:$TOKEN -X POST "https://registry.sujaypillai.dev/api/v0/repositories/hub" \
-H "accept: application/json" \
-H "content-type: application/json" \
-d "{
"enableManifestLists": true,
"immutableTags": false,
"longDescription": "",
"name": "golang",
"scanOnPush": true,
"shortDescription": "Go (golang) is a general purpose, higher-level, imperative programming language.",
"tagLimit": 0,
"visibility": "private"
}"
{
"id": "bbe261bf-97db-426b-8e47-25d597aeb058",
"namespace": "hub",
"namespaceType": "organization",
"name": "golang",
"shortDescription": "Go (golang) is a general purpose, higher-level, imperative programming language.",
"longDescription": "",
"visibility": "private",
"scanOnPush": true,
"immutableTags": false,
"enableManifestLists": true,
"pulls": 0,
"pushes": 0,
"tagLimit": 0
}
//Create a policy to mirror official golang image from DockerHub to your DTR
$curl -u sujaypillai:$TOKEN -X POST "https://registry.sujaypillai.dev/api/v0/repositories/hub/golang/pollMirroringPolicies?initialEvaluation=true" \
-H "accep: application/json" \
-H "content-type: application/json" \
-d "{
"enabled": true,
"password": "your_dockerhub_password",
"remoteCA": "",
"remoteHost": "https://index.docker.io",
"remoteRepository": "library/golang",
"skipTLSVerification": true,
"username": "your_dockerhub_account"
}"
{
"id": "d61201d5-89a6-4cca-81ca-93a1b889c765",
"username": "your_dockerhub_account",
"localRepository": "hub/golang",
"remoteHost": "https://index.docker.io",
"remoteRepository": "library/golang",
"remoteCA": "",
"skipTLSVerification": true,
"enabled": true,
"lastMirroredAt": "",
"lastStatus": null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment