user2301
user2301

Reputation: 1967

jfrog-cli in windows docker container - x509: certificate signed by unknown authority

I was trying to upload build artifacts from windows docker container to our hosted artifactory. I get this error x509: certificate signed by unknown authority, when running docker build. I am using Windows server 2016 VM with docker installed. I have corporate proxy on the server. I downloaded the jfrog.exe (jfrog version 1.20.2) from https://jfrog.com/getcli/ to Windows VM. Then copied the executable jfrog.exe to windows docker contaier. Is it the right way to install/copy the jfrog-cli in windows docker container? I am not sure what certificates are missing?

Below is the sample dockerfile:

FROM docker_registry/deploytools as deploy

ARG ARTIFACTORY_WEBSITE="https://.../artifactory"
ARG ARTIFACTORY_USER=""
ARG ARTIFACTORY_APIKEY=""
ARG ARTIFACTORY_ROOT_PATH=""

WORKDIR C:\\build

SHELL ["cmd", "/S", "/C"]

RUN echo "Deploying artifacts...." &&\
    C:\tools\7-Zip\7z.exe a artifacts.dv.zip C:\buid\artifacts &&\
    C:\tools\JFROG-CLI\jfrog rt config --url  %ARTIFACTORY_WEBSITE% --user %ARTIFACTORY_USER% --apikey %APIKEY% &&\
    C:\tools\JFROG-CLI\jfrog rt u "artifacts.dv.zip" %ARTIFACTORY_ROOT_PATH% --build-name=artifacts.dv --flat=false &&\
    C:\tools\JFROG-CLI\jfrog rt bp artifacts.dv &&\

CMD cmd

Upvotes: 3

Views: 2438

Answers (1)

retgits
retgits

Reputation: 1406

The x509 error you mentioned seems to indicate that the certificates used to connect to Artifactory (as specified by the ARTIFACTORY_WEBSITE variable) are not trusted. If you have the certificates, you can add them to your docker container and place them in the .jfrog/security folder

Copying from here

JFrog CLI supports accessing Artifactory over SSL using self-signed certificates as follows:

Under your user home directory, you should find a directory named .jfrog (this directory is created by the JFrog CLI first time it is used).
Under .jfrog, create a directory called security
Place your SSL certificate in your ~/.jfrog/security directory

To add them to your docker image during the build of the image, you can use the ADD command in your Dockerfile

Upvotes: 3

Related Questions