Accessing a QNX Container application image
In this section, and continuing from
Pushing a QNX Container application image to a repository
,
you access and pull the QNX Container images that you
pushed to Docker Hub, Amazon ECR, or local registry.
Importing a QNX Container application image from a file
qcmctl image import /data/home/root/hello-container-x86_64-qnx800.tar -n local/hello-container-x86_64-qnx800:v0
Pulling a QNX Container application image from Docker Hub
In this section, you can pull the QNX Container images from Docker Hub.
To pull images from Docker Hub, you must first authenticate (even for publicly available images). This authentication also requests for authorization. You must specify exactly which action (i.e., pull) you want to perform and the resource (i.e., the repository) you want to perform the action on.
#!/bin/bash
#
# Generate authentication token for Docker Hub
#
# requires jq for JSON parsing
# Exit on error
set -e
#optional if pulling a public repository
USER=
PASSWD=
DOCKER_REGISTRY=<somedockeruser>
REPOSITORY=hello-container-x86_64-qnx800
ROOT_PATH=$(mktemp -d ${TMPDIR:-/var/tmp}/docker-authXXXXXXXX)
TOKEN_FILE="$ROOT_PATH/docker.token"
if [ "$USER" != "" ] & [ "$PASSWD" != "" ]; then
AUTH=(-H "Authorization: Basic $(echo -n $USER:$PASSWD | base64)")
fi
# NOTE: change the following TARGET_IP variable to your QNX target's IP.
TARGET_IP=192.168.122.173
TARGET_DEST=/tmp/
AUTH_RESPONSE=$(curl "${AUTH[@]}" "https://auth.docker.io/token?service=registry.docker.io&scope=repository:$DOCKER_REGISTRY/$REPOSITORY:pull")
if [[ $AUTH_RESPONSE != *"token"* ]]; then
echo "Authentication failed:"
echo "$AUTH_RESPONSE"
exit 1
fi
TOKEN=$(echo -n $AUTH_RESPONSE |jq -r .token)
echo -n $TOKEN > $TOKEN_FILE
scp $TOKEN_FILE root@$TARGET_IP:$TARGET_DEST
rm $TOKEN_FILE
# TOKEN=$(cat /tmp/docker.token)
#
# qcmctl image pull https://registry-1.docker.io/<somedockeruser>/hello-container-x86_64-qnx800:v0 --token $TOKEN
sha256:cab3e5f365175ce5057ae80fcffe0673941af61f93099e9f519c79d4b96c4572
The Image ID is returned on the output.
The above was pulling the image that was built for x86_64,
but the same steps can be used for the aarch64 image with its respective image URI.
# qcmctl image pull https://registry-1.docker.io/<somedockeruser>/hello-container-x86_64-qnx800@sha256:01a24dc015b2929f8a258636d7b546021507799fdeb964fa05750829131e80cf --token $TOKEN
sha256:cab3e5f365175ce5057ae80fcffe0673941af61f93099e9f519c79d4b96c4572
Once downloaded, the image is then cached to the local image store on the QNX target.
# qcmctl image list
The output may look like the following example:
REPOSITORY TAG IMAGE ID CREATED SIZE
registry-1.docker.io/<somedockeruser>/hello-container-x86_64-qnx800 v0 cab3e5f36517 2025-03-11T15:56:55 1.76MB
Pulling a QNX Container application image from AWS ECR
In this section, you can pull the QNX Container images from AWS ECR.
#!/bin/bash
#
# Generate username/password pair from token for authentication with AWS ECR
# private repo.
#
# requires aws CLI
# Exit on error
set -e
ROOT_PATH=$(mktemp -d ${TMPDIR:-/var/tmp}/aws-private-auth-XXXXXXXXXX)
USER_FILE="$ROOT_PATH/aws-user.out"
PASS_FILE="$ROOT_PATH/aws-pass.out"
# NOTE: change the following TARGET_IP variable to your QNX target's IP.
TARGET_IP=192.168.122.77
TARGET_DEST=/tmp/
token=$(aws ecr get-authorization-token --output text --query 'authorizationData[].authorizationToken' | base64 -d)
name=${token%%:*}
pass=${token#*:}
echo -n $name > $USER_FILE
echo -n $pass > $PASS_FILE
scp $USER_FILE $PASS_FILE root@$TARGET_IP:$TARGET_DEST
- v0 in this case,
from AWS ECR and then invoke the qcmctl utility as follows:
# USER=$(cat /tmp/aws-user.out)
# PASS=$(cat /tmp/aws-pass.out)
#
# qcmctl image pull <aws_account_id>.dkr.ecr.us-east-1.amazonaws.com/hello-container-x86_64-qnx800:v0 --user $USER --passwd $PASS
sha256:cab3e5f365175ce5057ae80fcffe0673941af61f93099e9f519c79d4b96c4572
The Image ID is returned on the output.
The above was pulling the image that was built for x86_64,
but the same steps can be used for the aarch64 image with its respective image URI.
# qcmctl image pull <aws_account_id>.dkr.ecr.us-east-1.amazonaws.com/hello-container-x86_64-qnx800@sha256:01a24dc015b2929f8a258636d7b546021507799fdeb964fa05750829131e80cf --user $USER --passwd $PASS
sha256:cab3e5f365175ce5057ae80fcffe0673941af61f93099e9f519c79d4b96c4572
Once downloaded, the image is then cached to the local image store on the QNX target.
# qcmctl image list
REPOSITORY TAG IMAGE ID CREATED SIZE
<aws_account_id>.dkr.ecr.us-east-1.amazonaws.com/hello-container-x86_64-qnx800 v0 cab3e5f36517 2025-03-11T15:56:55 1.76MB
Pulling a QNX Container application image from Local Registry
When pulling an available image from a local Docker registry, use the authentication (none or basic) that was set up with the registry (as described in the previous sections).
- Pulling with No Authentication
qcmctl image pull http://<Your Host IP Address>:5000/hello-container-x86_64-qnx800:v0- Pulling with Basic Authentication
qcmctl image pull http://<Your Host IP Address>:5000/hello-container-x86_64-qnx800:v0 -u <user> -p <password>
