Create a Docker image

Once you’ve created a deployed QNX SDP installation, you can transfer it to a Docker image.

  1. To start, you can use the official Ubuntu Docker image. From a Ubuntu command shell, execute:
    sudo docker pull ubuntu
  2. To perform the following steps, you need to use two terminals.

    Open the first terminal and start a Docker container:
    sudo docker run -it --name user_defined_name ubuntu

    where user_defined_name is a name that you assign to the container.

    In response, the terminal should display this prompt: root@docker_container_ID

  3. Open a second terminal and copy the deployed QNX SDP installation into the Docker container:
    cd deployed_qnx710_directory
    sudo docker cp . user_defined_name:/deployed_qnx710_directory
  4. Return to the first terminal and enter the following commands.

    1. Populate the ~/.qnx directory in the Docker directory with the shareable license:
      source /qnx710/qnxsdp-env.sh

      The default Docker user is root and the home directory is /home/root. When qnxsdp-env.sh is sourced for the first time, it creates a /root/.qnx directory and populates it accordingly.

    2. If your Docker container is based on a Ubuntu 18.04 Docker image, you need to fix a missing kernel runtime link. At the root@docker_container_ID prompt, enter the following command:
      ln -s /lib64/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3
    3. Set up a connection to the license server:
      lmutil lmpath -override qnxlm @server_address
      where server_address is the IP address of your floating license server.
  5. In the second terminal, enter the following commands.
    1. Determine the container ID of the running Docker container:
      sudo docker ps
    2. Commit changes to a new Docker image:
      sudo docker commit docker_container_ID image_name
      where image_name is the name you assign to the Docker image.
    3. Stop the Ubuntu reference Docker container:
      sudo docker stop user_defined_name
      sudo docker rm user_defined_name
    4. Start a new container based on the newly created image, image_name, and confirm that the QNX SDP installation is included:
      sudo docker run -it image_name
      CAUTION:
      To comply with QNX licensing terms, don’t use the --network host option when starting a Docker container.

Your Docker image is now configured to be used in a build server environment. When launching Docker containers of this image, you must source /qnx710/qnxsdp-env.sh in order to set up the environment to build QNX-based applications.