TLDR: I try to push a docker image with curl, but the uploaded image is broken.
Context: Due to connectivity limitation, I have to access our Artifactory docker registry through an API gateway. Docker commands as login can't work as it tries to connect to a subdomain (eg my-registry.public-domain.com).
I can push/pull files to/from artifactory using Artifactory API with curl/jfrog CLI. My goal is to push a valid docker image to this Artifactory using the API only.
What I did is:
docker build . --file Dockerfile -t helloworld:v1.1
docker image save --output=helloworld-v1.1.tar helloworld:v1.1
mkdir v1.1; tar -xvf helloworld-v1.1.tar -C v1.1
jfrog rt upload "v1.1/*" my-registry/helloworld/ --url xyz.com/artifactory --user foo --password bar
(Previous command behave like a recursive curl put in the v1.1/ folder)
Each layer and the manifest .json have been uploaded on Artifactory but something is wrong. Docker info are empty:
Unable to extract Docker metadata for
'my-registry/helloworld/v1.1/'
And trying to pull the image from Openshift result in this error (It works with images uploaded the usual way on the same Artifactory):
Failed to pull image "my-registry.my-artifactory/helloworld:v1.1": rpc
error: code = Unknown desc = pinging container registry
l-docker-dev-workspace-dev.a-artifactory.vt.ch: invalid status code
from registry 400 (Bad Request)
Do you have any clue to explain such a behaviour? How can I transfer my .tar docker image to Artifactory to then be usable like any other image?
Any help is welcome, Have a great day!
For anyone looking to do the same thing, this thread answered my questions: Docker Private Registry Image Upload
I had to modify the script, as some of the commands were failing, and also to enable the upload of a docker image with multiple layers, but this is it.