Skip to content

Latest commit

 

History

History
52 lines (33 loc) · 2.56 KB

hints-for-use-with-docker.md

File metadata and controls

52 lines (33 loc) · 2.56 KB

Hints for using ORT with Docker

General Hints

Mount current working directory or directory relative to working directory

docker run \
  -v $PWD/:/project  \ # Mount current working directory into /project to use as input.
  ort --info analyze \
  -c /project/ort/config.hocon \ # Use file from "<workingdirectory>/ort" as config.
  analyze (...) # Insert further arguments for the command.

Note: The single forward slash / between the environment variable $PWD and the : is required for PowerShell compatibility, as PowerShell otherwise interprets : as part of the environment variable.

Common Issues

Docker build fails with an "SSL Handshake" error

Some web proxies, such as from Blue Coat (Symantec) do not support TLSv1.3, which leads to errors when Docker tries to establish a connection through them. The following steps allow to force a specific TLS version to be used:

  1. Insert ENV JAVA_OPTS="-Djdk.tls.client.protocols=TLSv1.2" in the Dockerfile, below the FROM line to force a specific TLS version.
  2. Run the build again, it should succeed now.

Authenticating with a private Git repository fails

To authenticate with a private Git repository, ORT uses the (semi)standardized .netrc file. With the following steps, .netrc can be used with Docker.

  1. Create a .netrc file:

    machine <hostname> login <username> password <password>
    

    For example:

    machine github.com login mygituser password mypersonaltoken
    

    Ensure that there are no additional spaces, newlines, tabs, or other whitespace characters after the hostname, username, or password. Some third-party tools would otherwise interpret these whitespace characters as part of the authentication string and cause authentication errors with some providers.

    Note: If you receive any authentication errors, double-check this file. The format often shared online with the properties separated by newlines does not work with Docker images for ORT, as not all included third-party tools support this format.

  2. Mount the .netrc into the home directory of the ORT Docker container. By default that is the /root directory:

    docker run -v <workspace_path>:/project -v <netrc_folder_path>/.netrc:/root/.netrc ort --info scan (...)

    Important: Ensure that the .netrc file has been created at netrc_folder_path before running the command, otherwise Docker will create a folder .netrc inside the container, instead of mounting a single file.