How to persist the config details of JFrog CLI in docker container

Amith Kumar Mutakari
2019-05-09 07:31

Summary

How to persist the config details of JFrog CLI which is installed with docker.

Affected Versions

NA

Details

Docker installation of JFrog CLI configuration is not persisted unless until we persist it explicitly.

For example docker run -it docker.bintray.io/jfrog/jfrog-cli-go:latest jfrog rt config

Artifactory server ID: art

Artifactory URL: http://<art-url>/artifactory

Access token (Leave blank for username and password/API key): 

User: admin

Password/API key: 

[Info] Encrypting password…

root@amith:/opt/artifactory-pro-5.4.6/bin# docker run -it docker.bintray.io/jfrog/jfrog-cli-go:latest jfrog rt c show

will not show any config details as the config container is dead.

Resolution

We can persist the config details for JFrog CLI using docker as below.

/root/.jfrog is the default location in the Docker container for JFrog CLI.

 

docker run -it -v <mount location in your OS>:/root/.jfrog docker.bintray.io/jfrog/jfrog-cli-go:latest jfrog rt c art –url=“http://<ARTURL>:8081/artifactory” –apikey=“AKCp5ccayRyZcjXFKKfrsHJfBQ5sGjg2ogkgK2WMftZkSaH6qFkfAnoXDanwX2mH3kYSiDZpH”

For example :- docker run -it -v /Users/amith:/root/.jfrog docker.bintray.io/jfrog/jfrog-cli-go:latest jfrog rt c art –url=“http://amith-art:8081/artifactory” –apikey=“AKCp5ccayRyZcjXFKKfrsHJfBQ5sGjg2ogkgK2WMftZkSaH6qFkfAnoXDanwX2mH3kYSiDZpH”

 

After this when we run the below command we are able to see the Artifactory config details.

 

docker run -it -v /Users/amithkm:/root/.jfrog docker.bintray.io/jfrog/jfrog-cli-go:latest jfrog rt c show 

Server ID: art

Url: “http://amith-art:8081/artifactory”/

API key: “AKCp5ccayRyZcjXFKKfrsHJfBQ5sGjg2ogkgK2WMftZkSaH6qFkfAnoXDanwX2mH3kYSiDZpH”

Default: true