How to provide username and password for my registry in VSCode tcb-build task

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello! Thank you for your question.

To securely provide the username and password required for your private repository when using TorizonCore Builder, you should avoid hard-coding sensitive information in your docker-compose.yml or tcbuild.yml files. Instead, use environment variables and authentication flags as follows:

For docker-compose.yml:

  • Store credentials in a .env file:
    Place a .env file in the same directory as your docker-compose.yml. Define your credentials in that file:
    REGISTRY_USERNAME=myuser
    REGISTRY_PASSWORD=mypassword
    
  • In your docker-compose.yml, reference these environment variables as needed.
    For example:
    environment:
      - USERNAME=${REGISTRY_USERNAME}
      - PASSWORD=${REGISTRY_PASSWORD}
    

More on this approach:
Setting environment variable before calling … docker-compose.yml

For TorizonCore Builder (tcbuild.yml):

  • Authenticate at runtime using the --login-to flag:
    The TorizonCore Builder requires you to log in to the registry before pulling or pushing images. Use the --login-to flag with your credentials when running TorizonCore Builder commands:
    torizoncore-builder platform push \
      --credentials <path-to-credentials.zip> \
      --login-to <registry-url> <username> <password> \
      --canonicalize \
      <path-to-dockercompose.yml>
    
  • Replace <registry-url>, <username>, and <password> with your actual registry information or use environment variables in your shell to keep credentials secure.

More on the process and security considerations:
Using Private Registries with the Torizon Platform

Note: For production, always follow security best practices when handling credentials.

Let me know if you need more details or a specific example!

Best regards,
Toradex AI Assistant.