Install docker Get docker v1 content: ------------------------------- $ docker pull busybox $ docker save busybox > busybox.tar Get docker v2 content: ------------------------------ Deploy registry on localhost by following example here: https://docs.docker.com/registry/deploying/ - Go as far as pushing the ubuntu image into the registry # Create docker repo for v1 content: pulp-admin docker repo create --repo-id mydocker1 # upload two docker images to mydocker 1 repository pulp-admin docker repo uploads upload --file busybox.tar --repo-id mydocker1 # Create docker v2 repo that will sync from local registry created earlier: pulp-admin docker repo create --feed http://127.0.0.1:5000 --upstream-name ubuntu --repo-id mydocker2 --auto-publish false ---- docker_rsync_distributor_config.json ---- { "distributor_id": "mydocker_rsync_distributor", "distributor_type_id": "docker_rsync_distributor", "distributor_config": { "remote": { "ssh_identity_file": "/home/vagrant/devel/my_rsa_key", "ssh_user": "dkliban", "host": "192.168.121.1", "root": "/home/dkliban/pulp_root_dir" }, "postdistributor_id": "docker_web_distributor_name_cli" } } ------------------------------------------------------------------------------------- -----create_mydocker-repo_with_rsync_predistributor.json--------- { "display_name": null, "description": null, "distributors": [{ "distributor_id": "docker_web_distributor_name_cli", "auto_publish": false, "distributor_config": { "repo-registry-id": "myregistry", "predistributor_id": "mydocker1_rsync_distributor" }, "distributor_type_id": "docker_distributor_web" }, { "distributor_id": "docker_export_distributor_name_cli", "auto_publish": false, "distributor_config": { "repo-registry-id": "myregistry" }, "distributor_type_id": "docker_distributor_export" }], "notes": { "_repo-type": "docker-repo" }, "importer_type_id": "docker_importer", "importer_config": { "feed": "http://127.0.0.1:5000", "ssl_ca_cert": null, "ssl_client_cert": null, "proxy_host": null, "max_downloads": null, "ssl_validation": null, "proxy_password": null, "proxy_port": null, "max_speed": null, "proxy_username": null, "validate": null, "upstream_name": "ubuntu", "ssl_client_key": null }, "id": "mydocker-repo" } --------------------------------------------------- ---- publish_docker_rsync.json ----- { "id": "mydocker_rsync_distributor" } ------------------------------------------------ --- publish_with_delete_docker_rsync.json --- { "id": "mydocker_rsync_distributor", "override_config": { "delete": "true" } } ------------------------------------------------ --- publish_content_units_only_docker_rsync.json --- { "id": "mydocker_rsync_distributor", "override_config": { "content_units_only": "true" } } ------------------------------------------------ --- publish_remote_path_docker_rsync.json --- { "id": "mydocker_rsync_distributor", "override_config": { "remote_units_path": "foo/bar" } } ------------------------------------------------ --- publish_docker_with_predistributor.json ---- { "id": "docker_web_distributor_name_cli", "override_config": { "predistributor_id": "mydocker_rsync_distributor" } } --------------------------------------------------------------- ----publish_docker_with_relative_path.json----------- { "id": "mydocker_rsync_distributor", "override_config": { "repo_relative_path": "my/cool/path" } } ----------------------------------------------------------------------- === Key based publish v1 content === # remove all content from remote server rm -rf /root/dir/on/remote/* # remove all locally published docker content rm -rf /var/lib/pulp/published/docker # Create docker repo for v1 content: pulp-admin docker repo create --repo-id mydocker1 # upload one docker images to mydocker1 repository pulp-admin docker repo uploads upload --file busybox.tar --repo-id mydocker1 # add docker rsync distributor to mydocker1 repository (with postdistributor_id defined) http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker1/distributors/ < docker_rsync_distributor_config.json # publish using docker rsync distributor http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker1/actions/publish/ < publish_docker_rsync.json # publish using the web distributor pulp-admin docker repo publish run --repo-id mydocker1 # verify how many docker images are in the repository content unit counts pulp-admin docker repo list --details --repo-id mydocker1 # verify that same number of images are present in mydocker1 directory on remote server # verify that content directory is populated and symlinks are pointing to existing files pulp-admin docker repo delete --repo-id mydocker1 pulp-admin orphan remove --all === Key based publish v2 content === # remove all content from remote server rm -rf /root/dir/on/remote/* # remove all locally published docker content rm -rf /var/lib/pulp/published/docker pulp-admin docker repo create --feed http://127.0.0.1:5000 --upstream-name ubuntu --repo-id mydocker2 --auto-publish false http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker2/distributors/ < docker_rsync_distributor_config.json pulp-admin docker repo sync run --repo-id mydocker2 http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker2/actions/publish/ < publish_docker_rsync.json pulp-admin docker repo list --details --repo-id mydocker2 # Check how many blobs, manifests, and tags are present in repo unit content counts (5, 1, 1 respectively) # verify that mydocker2/manifests, mydocker2/blobs, mydocker2/tags directories exist # verify that mydocker2/tags/list contains these contents { "name": "mydocker2", "tags": ["latest"] } # verify that content directory is populated with docker_blob and docker_manifest folders exist and contain content # verify symlinks are pointing to existing files === mix of v2 and v1 content ==== This test is a continuation of the previous test which published v2 pulp-admin docker repo uploads upload --file busybox.tar --repo-id mydocker2 http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker2/actions/publish/ < publish_docker_rsync.json pulp-admin docker repo list --repo-id mydocker2 # Check how many docker images, blobs, manifests, and tags are present in repo unit content counts (1, 5, 1, 1 respectively) # verify that mydocker2/manifests, mydocker2/blobs, mydocker2/tags, mydocker2/ directories exist # verify that mydocker2/tags/list contains these contents { "name": "mydocker2", "tags": ["latest"] } # verify that content directory is populated with docker_blob, docker_manifest, and docker_image folders exist and contain content # verify symlinks are pointing to existing files pulp-admin docker repo delete --repo-id mydocker2 pulp-admin orphan remove --all ==== repo-registry-id ======= # remove all content from remote server rm -rf /root/dir/on/remote/* # remove all locally published docker content rm -rf /var/lib/pulp/published/docker pulp-admin docker repo create --feed http://127.0.0.1:5000 --upstream-name ubuntu --repo-id mydocker-repo --auto-publish false --repo-registry-id myregistry http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker-repo/distributors/ < docker_rsync_distributor_config.json pulp-admin docker repo sync run --repo-id mydocker-repo http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker-repo/actions/publish/ < publish_docker_rsync.json # verify the repo directory is mydocker-repo pulp-admin docker repo list --repo-id mydocker-repo # verify how many blobs, manifests, and tags are present in repo unit content counts (5, 1, 1 respectively) # verify that mydocker-repo/manifests, mydocker-repo/blobs, mydocker-repo/tags directories exist # verify that mydocker-repo/tags/list contains these contents { "name": "myregistry", "tags": ["latest"] } # verify that content directory is populated with docker_blob and docker_manifest folders exist and contain content # verify symlinks are pointing to existing files pulp-admin docker repo delete --repo-id mydocker-repo pulp-admin orphan remove --all ==== test delete option ==== # remove all content from remote server rm -rf /root/dir/on/remote/* # remove all locally published docker content rm -rf /var/lib/pulp/published/docker pulp-admin docker repo create --feed http://127.0.0.1:5000 --upstream-name ubuntu --repo-id mydocker-repo --auto-publish false http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker-repo/distributors/ < docker_rsync_distributor_config.json pulp-admin docker repo sync run --repo-id mydocker-repo # do the first publish http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker-repo/actions/publish/ < publish_docker_rsync.json # Add in extra files into the mydocker-repo published repo on the remote touch mydocker-repo/afile touch mydocker-repo/blobs/afile touch mydocker-repo/manifests/afile touch mydocker-repo/tags/afile # Do the second publish http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker-repo/actions/publish/ < publish_with_delete_docker_rsync.json # verify that the added files have been removed pulp-admin docker repo delete --repo-id mydocker-repo pulp-admin orphan remove --all ==== test content_units_only option ==== # remove all content from remote server rm -rf /root/dir/on/remote/* # remove all locally published docker content rm -rf /var/lib/pulp/published/docker pulp-admin docker repo create --feed http://127.0.0.1:5000 --upstream-name ubuntu --repo-id mydocker-repo --auto-publish false http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker-repo/distributors/ < docker_rsync_distributor_config.json pulp-admin docker repo sync run --repo-id mydocker-repo # publish with the override option http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker-repo/actions/publish/ < publish_content_units_only_docker_rsync.json # verify that the repo directory is not published # verify that the content directory is published pulp-admin docker repo delete --repo-id mydocker-repo pulp-admin orphan remove --all ==== remote_units_path ==== # remove all content from remote server rm -rf /root/dir/on/remote/* # remove all locally published docker content rm -rf /var/lib/pulp/published/docker pulp-admin docker repo create --feed http://127.0.0.1:5000 --upstream-name ubuntu --repo-id mydocker-repo --auto-publish false http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker-repo/distributors/ < docker_rsync_distributor_config.json pulp-admin docker repo sync run --repo-id mydocker-repo # publish with the override option http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker-repo/actions/publish/ < publish_remote_path_docker_rsync.json # verify that there is no 'content' directory # verify that there is a foo/bar directory pulp-admin docker repo delete --repo-id mydocker-repo pulp-admin orphan remove --all ==== rsync distributor as predistributor for web distributor ==== --- publish_docker_with_predistributor.json ---- { "id": "docker_web_distributor_name_cli", "override_config": { "predistributor_id": "mydocker_rsync_distributor" } } --------------------------------------------------------------- # remove all content from remote server rm -rf /root/dir/on/remote/* # remove all locally published docker content rm -rf /var/lib/pulp/published/docker # create docker repo to sync v2 content pulp-admin docker repo create --feed http://127.0.0.1:5000 --upstream-name ubuntu --repo-id mydocker-repo --auto-publish false # sync the v2 content pulp-admin docker repo sync run --repo-id mydocker-repo # validate that an auto publish did not occur (on local pulp install, not remote) # add rsync distributor http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker-repo/distributors/ < docker_rsync_distributor_config.json # publish using web distributor with rsync distributor defined as the predistributor http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker-repo/actions/publish/ < publish_docker_with_predistributor.json # verify that the publish is skipped in the task details because the rsync predistributor has not published yet # publish using rsync distributor http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker-repo/actions/publish/ < publish_docker_rsync.json # verify that content directory contains v2 blobs and manifests are published to remote server # verify that the mydocker-repo has been published to remote server # upload the v1 image pulp-admin docker repo uploads upload --file busybox.tar --repo-id mydocker-repo # publish using web distributor with rsync distributor defined as the predistributor http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker-repo/actions/publish/ < publish_docker_with_predistributor.json # verify that the publish is performed, but only the v2 content is published because that was all the rsync distributor published # publish using rsync distributor http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker-repo/actions/publish/ < publish_docker_rsync.json # verify that both v2 and v1 content is published to the remote server # publish using web distributor with rsync distributor defined as the predistributor http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker-repo/actions/publish/ < publish_docker_with_predistributor.json # verify that both v1 and v2 content is published locally pulp-admin docker repo delete --repo-id mydocker-repo pulp-admin orphan remove --all ===== rsync with repo_relative_path ===== # remove all content from remote server rm -rf /root/dir/on/remote/* # remove all locally published docker content rm -rf /var/lib/pulp/published/docker # Create docker repo for v1 content: pulp-admin docker repo create --repo-id mydocker1 # upload one docker images to mydocker1 repository pulp-admin docker repo uploads upload --file busybox.tar --repo-id mydocker1 # add docker rsync distributor to mydocker1 repository (with postdistributor_id defined) http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker1/distributors/ < docker_rsync_distributor_config.json # publish using docker rsync distributor http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/mydocker1/actions/publish/ < publish_docker_with_relative_path.json # verify how many docker images are in the repository content unit counts pulp-admin docker repo list --details --repo-id mydocker1 # verify that same number of images are present in my/cool/path directory on remote server # verify that content directory is populated and symlinks are pointing to existing files