Making a QNX Container application image available to the target

In this section, you make a container application image available to the target.

You can copy an image directly onto a QNX target for instant access or push the image to a remote or local registry for the target to pull the image from. You can choose from the following methods:

Copying a container image to a target

Use the docker save command on the host to export the container image to a .tar file format so that it can be imported onto a QNX target:
docker save -o hello-container-x86_64-qnx800.tar hello-container-x86_64-qnx800:v0
Then, copy it to the target using the scp command:
scp hello-container-x86_64-qnx800.tar root@<Target IP Address>:./

Pushing a container image to remote registry

The container image can be pushed to a remote registry, which provides us with a central location for keeping and sharing the image, and it can then be pulled down to a QNX target.

You can push the image to either Docker Hub or Amazon ECR.

Pushing to Docker Hub

Pushing an image to Docker Hub is the easiest way to make your images available to a central location.

You need the Docker CLI (if you used Docker to build your image) and a Docker Account. For detail on DockerHub, refer to Docker Hub quickstart at https://docs.docker.com/docker-hub/quickstart

To push to Docker Hub, log in with your Docker account using the Docker CLI:
$ docker login -u <docker_username>

i Info → A Personal Access Token (PAT) can be used instead.
      To create a PAT, visit https://app.docker.com/settings


Password:

WARNING! Your credentials are stored unencrypted in '/home/<user>/.docker/config.json'.
Configure a credential helper to remove this warning. See
https://docs.docker.com/go/credential-store/

Login Succeeded
Once you've logged in, tag your image with your Docker username, and push the tag:
$ docker tag hello-container-x86_64-qnx800:v0 <docker_username>/hello-container-x86_64-qnx800:v0
$ docker push <docker_username>/hello-container-x86_64-qnx800:v0
The push refers to repository [docker.io/<docker_username>/hello-container-x86_64-qnx800]
a5189d25b999: Pushed
baba2e76f1d6: Pushed
v3: digest: sha256:3f2a2573951019913549b6b9dbe5a5fed3c6559ee90cb4e93ba022d3c8af311b size: 736

Pushing to Amazon Elastic Container Registry (ECR)

You can push the container image to Amazon ECR.

For how to setup and use Amazon's ECR, refer to the following Amazon documentation:
In keeping with the example application, you should already have private ECR repositories created for the two QNX Container images built in the previous section: one for x86_64 and another for aarch64.
Note:
A repository with a name matching the container image must already exist on AWS ECR before pushing the image. Multiple repositories may exist in the ECR repository area.
To create a new repository on AWS that matches the container you intend to use on the QNX target, follow these steps:
  1. Login to your AWS account
  2. Go to Services and select Containers
  3. Choose Elastic Container Registry
  4. Choose create a repository
  5. Make the container private
  6. Use the same name that matches your locally built container (e.g., hc_container-x86_64-qnx800)
  7. Make the tag mutable
To configure your local Linux machine to use with your AWS access ids and region you can:
  1. Install the AWS CLI tool; for instructions, refer to Installing or updating to the latest version of the AWS CLI of AWS Command Line Interface documentation at https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
  2. Run aws configure.
  3. You should be prompted for your access key id and secret access key, which you can find on your dashboard by selecting on your account name and then selecting Security Credentials. You should see your access key id listed.
  4. For region, choose the region you have logged in as and where the repository is located.
  5. Output format can be set to none.
Note:
As of June 2025, AWS access keys expires after about 12 hr time period, so you need to create new access keys from dashboard. You can query your current access key info that is stored on your local machine with the command: aws configure export-credentials.
Proceeding with the actual push operation, you use the Docker client.
  1. Authenticate your Docker client to the registry:
    aws ecr get-login-password | docker login -u AWS --password-stdin "https://$(aws sts get-caller-identity --query 'Account' --output text).dkr.ecr.us-east-1.amazonaws.com"
    Note:
    The login token obtained from the above command expires after 12 hours. The command needs to run again after that time to generate a new token. Otherwise, the push operation from Docker faila.
  2. In Docker, tag your local images with the repository names:
    ❯ docker tag hello-container-x86_64-qnx800:v0 $(aws sts get-caller-identity --query 'Account' --output text).dkr.ecr.us-east-1.amazonaws.com/hello-container-x86_64-qnx800:v0
    ❯ docker tag hello-container-aarch64-qnx800:v0 $(aws sts get-caller-identity --query 'Account' --output text).dkr.ecr.us-east-1.amazonaws.com/hello-container-aarch64-qnx800:v0
  3. Finally, push your QNX Container images to their respective ECR repositories:
    ❯ docker push <aws_account_id>.dkr.ecr.us-east-1.amazonaws.com/hello-container-x86_64-qnx800:v0
    The push refers to repository [<aws_account_id>.dkr.ecr.us-east-1.amazonaws.com/hello-container-x86_64-qnx800]
    590d8fe43ea1: Pushed 
    d1f4666a8660: Pushed 
    v0: digest: sha256:01a24dc015b2929f8a258636d7b546021507799fdeb964fa05750829131e80cf size: 736
    
    ❯ docker push <aws_account_id>.dkr.ecr.us-east-1.amazonaws.com/hello-container-aarch64-qnx800:v0
    The push refers to repository [<aws_account_id>.dkr.ecr.us-east-1.amazonaws.com/hello-container-aarch64-qnx800]
    c6dc47e90b12: Pushed 
    3cd6b4ad2d40: Pushed 
    v0: digest: sha256:ff854da10c20ded23707814eacdb8456f496f724c900757f3ea62d5f535d0569 size: 736
Note:
The push creates a manifest image rather than a manifest list, A manifest list is a single image that supports multiple platforms. Based on the system that the container is running on, the QNX Container Manager can select the appropriate architecture and OS. While the Docker solution supports manifest list images, QNX Containers may not support building a manifest list image.

Pushing a container image to a local registry

You can set up a local Docker registry on your host to make a container image available to the QNX target For instructions to install a local Docker Registry, refer to How to Use Your Own Registry at https://www.docker.com/blog/how-to-use-your-own-registry-2/
Note:
The link specifies Docker Registry version 2.7. QNX Containers 1.0 works with Docker Registry 3.0. In the following steps, you'll see the command docker run -d -p 5000:5000 --name registry registry:3.0.

You can set up your local registry with No Authorization or Basic Authentication.

Local Registry with No Authorization

  1. Configure Docker CLI on your local host for insecure local registry by editing /etc/docker/daemon.json and add the following:
    {
    "insecure-registries": ["http://127.0.0.1:5000"]
    }
  2. Run the following commands:
    sudo systemctl daemon-reload
    sudo systemctl restart docker
  3. Pull the Docker registry from Docker hub:
    docker pull registry:latest
  4. Run the Docker registry container:
    docker run -d -p 5000:5000 --name registry registry:3.0
  5. Check that the Docker registry is running:
    docker ps
  6. Check for the images in the local registry's repository:
    curl -X GET http://localhost:5000/v2/_catalog
  7. Tag the local application image:
    docker tag hello-container-x86_64-qnx800:v0  localhost:5000/hello-container-x86_64-qnx800:v0
    		
  8. Push image to the local Docker registry:
    docker push localhost:5000/hello-container-x86_64-qnx800:v0

Local Registry with Basic Authentication Setup

  1. Install httpasswd on host machine:
    sudo apt-get install -y apache2-utils
  2. Create user and password file:
    mkdir /home/<user>/httpasswd
    cd httpasswd
    htpasswd -Bc registry.passwd  <user>
  3. Verify user and password is correct:
    htpasswd -vb registry.passwd  <user>  <password>
  4. Run docker registry container with basic authentication enabled:
    docker run -d -p 5000:5000 \
    --name registry \
    -v /home/<user>/httpasswd/registry.passwd:/etc/docker/registry.passwd \
    -e REGISTRY_AUTH=htpasswd \
    -e REGISTRY_AUTH_HTPASSWD_REALM="Registry Realm" \
    -e REGISTRY_AUTH_HTPASSWD_PATH=/etc/docker/registry.passwd \
    registry:3.0
  5. Login with docker client:
    docker login localhost:5000 -u <user> -p <password>
  6. Check for images in the local registry's repository:
    curl -X GET http://localhost:5000/v2/_catalog -u <user> -p <password>
  7. Tag the local application image:
    docker tag hello-container-x86_64-qnx800:v0  localhost:5000/hello-container-x86_64-qnx800:v0
  8. Push image to local docker registry:
    docker push localhost:5000/hello-container-x86_64-qnx800:v0
Page updated: