Skip to content

Instantly share code, notes, and snippets.

@ipanova
Last active July 21, 2021 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipanova/87a13bdb3f439a8dc3b42ba728c68a25 to your computer and use it in GitHub Desktop.
Save ipanova/87a13bdb3f439a8dc3b42ba728c68a25 to your computer and use it in GitHub Desktop.
skopeo-sync for air-gapped envs
1. login to the PUlp container registry and push images
podman push localhost:24817/test/repo --tls-verify=false
Getting image source signatures
Copying blob 5b8c72934dfc done
Copying config 69593048aa done
Writing manifest to image destination
Storing signatures
(pulp) [vagrant@pulp3-source-fedora34 ~]$ http :24817/pulp/api/v3/distributions/container/container/
HTTP/1.1 200 OK
Access-Control-Expose-Headers: Correlation-ID
Allow: GET, POST, HEAD, OPTIONS
Connection: close
Content-Length: 667
Content-Type: application/json
Correlation-ID: ad496a2ee1a64f4ca27b89710b3abb3b
Date: Wed, 21 Jul 2021 11:10:55 GMT
Server: gunicorn
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"base_path": "test/repo",
"content_guard": "/pulp/api/v3/contentguards/container/content_redirect/8d76caec-0744-4732-aa58-5f92bdaccce1/",
"description": null,
"name": "test/repo",
"namespace": "/pulp/api/v3/pulp_container/namespaces/6de42df7-5ea8-46a5-9256-45fe0233d059/",
"private": false,
"pulp_created": "2021-07-21T11:10:45.074548Z",
"pulp_href": "/pulp/api/v3/distributions/container/container/4d246845-af98-45aa-938f-67d434126b73/",
"pulp_labels": {},
"registry_path": "localhost:24817/test/repo",
"repository": "/pulp/api/v3/repositories/container/container-push/4cbc82ce-8230-486a-b18b-70f064f1594a/",
"repository_version": null
}
]
}
2. Create directory into which you plan to export the image
(pulp) [vagrant@pulp3-source-fedora34 ~]$ mkdir /tmp/air-gapped
3. Run skopeo sync command( you should be logged into the registry. skopeo uses same credentias as podman)
$ skopeo sync --src docker --dest dir localhost:24817/test/repo:latest /tmp/air-gapped --tls-verify=false
WARN[0000] '--tls-verify' is deprecated, please set this on the specific subcommand
INFO[0000] Tag presence check imagename="localhost:24817/test/repo:latest" tagged=true
FATA[0000] Refusing to overwrite destination directory "/tmp/air-gapped/repo:latest"
(pulp) [vagrant@pulp3-source-fedora34 ~]$ rm -rf /tmp/air-gapped/repo\:latest/
(pulp) [vagrant@pulp3-source-fedora34 ~]$ skopeo sync --src docker --dest dir localhost:24817/test/repo:latest /tmp/air-gapped --tls-verify=false
WARN[0000] '--tls-verify' is deprecated, please set this on the specific subcommand
INFO[0000] Tag presence check imagename="localhost:24817/test/repo:latest" tagged=true
INFO[0000] Copying image ref 1/1 from="docker://localhost:24817/test/repo:latest" to="dir:/tmp/air-gapped/repo:latest"
Getting image source signatures
Copying blob a9efad4c351b done
Copying config 69593048aa done
Writing manifest to image destination
Storing signatures
INFO[0010] Synced 1 images from 1 sources
(pulp) [vagrant@pulp3-source-fedora34 ~]$ ll /tmp/air-gapped/
total 0
drwxr-xr-x. 2 vagrant vagrant 120 Jul 21 11:14 repo:latest
4. Login with podman or skopeo into the air-gapped environment
(pulp) [vagrant@pulp3-source-fedora34 ~]$ skopeo login localhost:24817 --tls-verify=false
Username: admin
Password:
Login Succeeded!
5. Skopeo sync the image into the registry
(pulp) [vagrant@pulp3-source-fedora34 ~]$ skopeo sync --src dir --dest docker /tmp/air-gapped/repo:latest localhost:24817/test/ --tls-verify=false
WARN[0000] '--tls-verify' is deprecated, please set this on the specific subcommand
INFO[0000] Copying image ref 1/1 from="dir:/tmp/air-gapped/repo:latest" to="docker://localhost:24817/test/repo:latest"
Getting image source signatures
Copying blob a9efad4c351b done
Copying config 69593048aa done
Writing manifest to image destination
Storing signatures
INFO[0024] Synced 1 images from 1 sources
(pulp) [vagrant@pulp3-source-fedora34 ~]$ http :24817/pulp/api/v3/distributions/container/container/
HTTP/1.1 200 OK
Access-Control-Expose-Headers: Correlation-ID
Allow: GET, POST, HEAD, OPTIONS
Connection: close
Content-Length: 667
Content-Type: application/json
Correlation-ID: 9ec50e6f75e04197849b9dd0fcc95b36
Date: Wed, 21 Jul 2021 11:17:08 GMT
Server: gunicorn
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"base_path": "test/repo",
"content_guard": "/pulp/api/v3/contentguards/container/content_redirect/30e6384c-ab24-424d-bcad-a70302e1021b/",
"description": null,
"name": "test/repo",
"namespace": "/pulp/api/v3/pulp_container/namespaces/bfdf34ff-3187-4fbc-b24e-8e925ce1a005/",
"private": false,
"pulp_created": "2021-07-21T11:16:59.533478Z",
"pulp_href": "/pulp/api/v3/distributions/container/container/5c68cdd2-e794-4c5e-84d0-f4fcd073bf8e/",
"pulp_labels": {},
"registry_path": "localhost:24817/test/repo",
"repository": "/pulp/api/v3/repositories/container/container-push/4a2b3b52-21bd-4198-957e-e4c8f6cc7a5b/",
"repository_version": null
}
]
}
(pulp) [vagrant@pulp3-source-fedora34 ~]$ podman pull localhost:24817/test/repo --tls-verify=false
Trying to pull localhost:24817/test/repo:latest...
Getting image source signatures
Copying blob a9efad4c351b [--------------------------------------] 0.0b / 0.0b
Copying config 69593048aa done
Writing manifest to image destination
Storing signatures
69593048aa3acfee0f75f20b77acb549de2472063053f6730c4091b53f2dfb02
(pulp) [vagrant@pulp3-source-fedora34 ~]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment