Where is images in registry:2 - docker-registry

Where is images in registry:2
If I exec into the container running the registry:
docker exec -it kind-registry sh
Do you know where I can see a list of images - to be able to list and delete.

You can use the API to curl the private registry. Further reading at the Docker Forum.
curl http://my.registry.com/v2/_catalog
Should work.

Related

Script to push and pull all images from nexus to harbor

i want to pull from nexus all images and push them in harbor i try to do that
docker login -u -p https://harbor.domaine.com/
docker tag nexus.domaine.com/tag:number harbor.domaine.com/project_name/tag:number
but the problem is that i have a lot of images and if i do this operation i need to write 1 line for every images so i want something like a loop too pull and push all images from nexus any help ?!
You can try use bash script, for example
#!/bin/bash
docker login -u -p https://harbor.domaine.com/
for image_name in $(docker images --format="{{.Repository}}:{{.Tag}}" | grep nexus.domaine.com)
do
new_image_name=$(echo $image_name | sed 's/nexus.domaine.com/harbor.domaine.com\/project_name/')
docker tag $image_name $new_image_name
docker push $new_image_name
done
I've been developing regsync to do exactly this. For a quick start, there's a workshop I recently gave at the docker all-hands, which includes not only the copy, but also the cleanup steps, or there's the quick start in the project itself.
To implement, create a regsync.yml:
version: 1
creds:
- registry: nexus.domaine.com
# credentials here
- registry: harbor.domaine.com
# credentials here
defaults:
parallel: 2
interval: 60m
sync:
- source: nexus.domaine.com/image
target: harbor.domaine.com/project_name/image
type: repository
And then run regsync:
docker container run -it --rm \
-v "$(pwd)/regsync.yml:/home/appuser/regsync.yml:ro" \
regclient/regsync:latest -c /home/appuser/regsync.yml once

How can I use Docker and Verdaccio, publish a package, then share that Docker Image to another person with the Package showing up?

I have got the Verdaccio running with docker on my system using:
docker pull verdaccio/verdaccio
docker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio
I can then see my Verdaccio at localhost:4873.
I add a user:
npm adduser --registry http://localhost:4873/
I go to a simple package repo and publish it:
npm publish --registry http://localhost:4873/
I then go to the browser and see my package is in the list on localhost
I then rename my docker container:
docker rename 4d2b---3692 my-container
On docker hub I have a repo called myuser/my-container
I then commit my container
docker commit 93ba9d----e myuser/my-container
Then I push it to Docker Hub (I did log in already)
docker push myuser/my-container
I see that it is updated on my Docker Hub.
I remove everything related to Docker on my computer
docker rmi --force 93ba9d----e
I then see nothing when I run these commands
docker ps -a
docker images
Then I try and pull my container
docker pull myuser/my-container
I then run my container
docker run -it --rm --name verdaccio -p 4873:4873 myuser/my-container
I can then see the Verdaccio page on localhost:4873, however I can not see the published package.
Please let me know what I am missing, thanks.

pull and push docker image to localhost via dind

When build images in dind (docker in docker), the image is only accessible in dind.
$ docker run -d --name dind --privileged --net=host -v `pwd`:/app -w /app docker:stable-dind
fe66d6e7e5effcf15e439a332a2368fddab810e9bc8ac3445392c8e56b0aa38a
$ docker exec dind ls
Dockerfile
$ docker exec dind docker build -t demo .
Sending build context to Docker daemon 521.7kB
Step 1/24 : FROM alpine
...
$ docker exec dind docker images|grep demo
REPOSITORY TAG IMAGE ID CREATED SIZE
demo latest a9dd4e725029 7 seconds ago 88.3MB
$ docker images |grep demo
<no result>
I can push the image to public or private docker registry server in dind, because they have IP or dns name to access. But how can I push the new image back to localhost (the host running dind)
Second, if I want to pull image from localhost in Dind, how to do that?
I can answer my first question now.
$ docker exec dind docker save demo |docker load
2f7d711abbe9: Loading layer [==================================================>] 11.44MB/11.44MB
...
Loaded image: demo:latest
$ docker images |grep demo
demo latest a9dd4e725029 8 minutes ago 88.3MB
Same size :-)
But still not sure how to pull image from localhost in Dind, any ideas?

Docker: google/docker-registry container usage

Does the google/docker-registry container exist solely to push/pull images from Google Cloud Storage? I am currently following their instructions on Git and have the docker-registry container running, but can't seem to pull from my bucket.
I started it with:
sudo docker run -d -e GCS_BUCKET=mybucket -p 5000:5000 google/docker-registry
I have a .tar Docker image stored in Cloud Storage, at mybucket/imagename.tar. However, when I execute:
sudo docker pull localhost:5000/imagename.tar
It results in:
2014/07/10 19:15:50 HTTP code: 404
Am I doing this wrong?
You need to docker push to the registy instead of copying your image tar manually.
From where you image is:
docker run -ti --name gcloud-config google/cloud-sdk \
gcloud auth login
docker run -ti --volumes-from gcloud-config google/cloud-sdk \
gcloud config set project <project>
docker run -d -e GCS_BUCKET=bucketname -p 5000:5000 \
--volumes-from gcloud-config google/docker-registry
docker tag imagename localhost:5000/imagename
docker push localhost:5000/imagename
Then from the place you want to run the image from (ex: GCE):
docker run -d -e GCS_BUCKET=bucketname -p 5000:5000 google/docker-registry
docker run localhost:5000/imagename
When using the google/docker-registry it is preconfigured to use the google buckets.
It should work for any storage (if configuration is overriden), but it's purpose is to be used with the google infrastructure.
The tar file of an exported image should be used when there is no docker registry to manually move images between docker hosts.
You should not upload tar files to the bucket.
To upload images, you should push to the docker-registry container, it will the save the image in the bucket.
The google cloud compute instance that is running the docker registry container must be configured to have write/read access to the bucket.

Boot2Docker to Google Compute Engine VM: saving Docker container

I am running Boot2Docker v1.0.1 on Windows, and wish to fire up a Docker container I have created on a Google Compute Engine VM.
In order to do so, I need to save the container and upload it to Google Cloud Storage.
I issue the following command:
docker save --output=mycontainer.tar mycontainer:latest
The command completes without error. However, I cannot find the rce_env.tar file anywhere on my hard drive.
Does anyone have any experience with this? If not, is there a better way to run containers on GCE VM's?
You can run google/docker-registry locally to push your container images to GCS.
docker run -ti --name gcloud-config google/cloud-sdk \
gcloud auth login
docker run -ti --volumes-from gcloud-config google/cloud-sdk \
gcloud config set project <project>
docker run -d -e GCS_BUCKET=bucketname -p 5000:5000 \
--volumes-from gcloud-config google/docker-registry
docker tag imagename localhost:5000/imagename
docker push localhost:5000/imagename
And then run it on GCE to pull your containers from GCS.
docker run -d -e GCS_BUCKET=bucketname -p 5000:5000 google/docker-registry
docker run localhost:5000/imagename
I understand that you are using boot2docker on windows.
On a similar setup, using OSX and boot2docker 1.1.0, the following works:
docker save --output mycontainer.tar mycontainer:latest
As also does redirecting standard output:
docker save mycontainer:latest > mycontainer.tar
GCE now allows to store docker images for your projects using the gcloud command.
you can now run $ gcloud preview docker push gcr.io/YOUR-PROJECT/IMAGE-NAME
Source: https://cloud.google.com/tools/container-registry/#pushing_to_the_registry

Resources