Add libraries required for test execution to the Docker image of a Docker project. Use one of the following two options.

Copy a Local Library Directory to the Docker Image

  1. In the [Add User Library] or [Edit User Library] dialog, select the [Copy Directory from Local].
  2. Click [Browse…] and specify the library directory to copy into the Docker image.
  3. In the [Module Properties] > [Build] page, enter the following flags in the [Link Flag] field.
    • -l<library name> -L<library path>
      • -l: Specify the library file name without the file extension.
      • -L: Specify the directory path where the library is located.

Install Libraries in the Docker Image Using a Command

  1. In the [Add User Library] or [Edit User Library] dialog, select [Install Library from Remote].
  2. Enter the library installation command in the input field below the option.

Command Input Guide

When installing libraries in the Docker environment using commands, it is recommended to combine multiple commands into a single line.

  • When using apt-get:
    • Always include the apt-get update command.
    • Always use the -y option in the install command.
    • Add apt-get clean and rm -rf /var/lib/apt/lists/ at the end to reduce the image size.
    • Example:
      apt-get update && \
      apt-get install -y \
      example-package && \
      apt-get clean && \
      rm -rf /var/lib/apt/lists/*
  • When using wget:
    • Add rm -f /tmp/package.deb at the end to reduce the image size.
    • Example:
      wget -qO /tmp/package.deb https://example.com/path/to/package.deb && \
      dpkg -i /tmp/package.deb && \
      rm -f /tmp/package.deb
  • When building and installing from source files, use the following example:
    apt-get update && apt-get install -y build-essential git cmake && \
    git clone https://github.com/example/project.git /opt/project && \
    cd /opt/project && \
    mkdir build && cd build && \
    cmake .. && \
    make -j$(nproc) && \
    make install && \
    rm -rf /opt/project

Need more help with this?
Don’t hesitate to contact us here.

Thanks for your feedback.