Host and Consume a Container Repository

This section assumes that you have a repository with content in it. To do this, see the Synchronize a Repository documentation.

Create a Container Distribution to serve your Repository Version

Container Distributions can be used to serve the Container registry API containing the content in a repository’s latest version or a specified repository version.

#!/usr/bin/env bash

export DIST_NAME='testing-hello'
export DIST_BASE_PATH='test'

# Distributions are created asynchronously.
echo "Creating distribution \
  (name=$DIST_NAME, base_path=$DIST_BASE_PATH repository=$REPO_HREF)."
export TASK_HREF=$(http POST $BASE_ADDR/pulp/api/v3/distributions/container/container/ \
  name=$DIST_NAME \
  base_path=$DIST_BASE_PATH \
  repository=$REPO_HREF | jq -r '.task')

# Poll the task (here we use a function defined in docs/_scripts/
wait_until_task_finished $BASE_ADDR$TASK_HREF

echo "Setting DISTRIBUTION_HREF from the completed task."
# DISTRIBUTION_HREF is the pulp-api HREF, not the content app href
export DISTRIBUTION_HREF=$(http $BASE_ADDR$TASK_HREF | jq -r '.created_resources | first')

echo "Inspecting Distribution."


    "pulp_created": "2019-09-05T14:29:51.742086Z",
    "pulp_href": "/pulp/api/v3/distributions/container/container/1b461dac-0839-4049-aa8f-92f8e8f7f034/",
    "base_path": "test",
    "content_guard": null,
    "name": "testing-hello",
    "registry_path": "localhost:24816/test",
    "repository": "/pulp/api/v3/repositories/container/container/fcf03266-f0e4-4497-8434-0fe9d94c8053/",
    "repository_version": null

Reference: Container Distribution Usage

Pull and run an image from Pulp

Once a distribution is configured to host a repository with Container images in it, that content can be consumed by container clients.


$ podman pull localhost:24816/foo

If SSL has not been setup for your Pulp, configure podman to work with the insecure registry:

Edit the file /etc/containers/registries.conf. and add:

registries = ['localhost:24816']

More info:


If SSL has not been setup for your Pulp, configure docker to work with the insecure registry:

Edit the file /etc/docker/daemon.json and add:

    "insecure-registries" : ["localhost:24816"]


More info:

#!/usr/bin/env bash


echo "Setting REGISTRY_PATH, which can be used directly with the Docker Client."
export REGISTRY_PATH=$(http $BASE_ADDR$DISTRIBUTION_HREF | jq -r '.registry_path')

echo "Next we pull the image from pulp and run it."

Docker Output:

Unable to find image 'localhost:24816/test:latest' locally
Trying to pull repository localhost:24816/test ...
sha256:451ce787d12369c5df2a32c85e5a03d52cbcef6eb3586dd03075f3034f10adcd: Pulling from localhost:24816/test
1b930d010525: Pull complete
Digest: sha256:451ce787d12369c5df2a32c85e5a03d52cbcef6eb3586dd03075f3034f10adcd
Status: Downloaded newer image for localhost:24816/test:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:

For more examples and ideas, visit: