Skip to content

Instantly share code, notes, and snippets.

@mamun67
Last active July 11, 2020 07:03
Show Gist options
  • Select an option

  • Save mamun67/af4dc2a72dbd36d4f70dbbafc63f1aa2 to your computer and use it in GitHub Desktop.

Select an option

Save mamun67/af4dc2a72dbd36d4f70dbbafc63f1aa2 to your computer and use it in GitHub Desktop.
Docker Registry Setup
docker run -d -p 5000:5000 --restart always --name registry registry:2
docker run --rm -it -p 5000:5000 registry:2
http://localhost:5000/v2/_catalog
//format to to push image into the registry
format: source image registry:port/repository [:tag]
docker tag mongo localhost:5000/mongo
docker push localhost:5000/mongo
//after adding registries
docker image pull 127.0.0.1:5000/mongo
docker config file
cat /etc/default/docker
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
docker_opts update
https://github.com/moby/moby/issues/9889
DOCKER UI
https://hub.docker.com/r/konradkleine/docker-registry-frontend
This application is available in the form of a Docker image that you can run as a container by executing this command:
sudo docker run \
-d \
-e ENV_DOCKER_REGISTRY_HOST=127.0.0.1 \
-e ENV_DOCKER_REGISTRY_PORT=5000 \
-p 8080:80 \
konradkleine/docker-registry-frontend:v2
This command starts the container and forwards the container's private port 80 to your host's port 8080. Make sure you specify the correct url to your registry.
When the application runs you can open your browser and navigate to http://localhost:8080.
SSL encryption
If you want to run the application with SSL enabled, you can do the following:
sudo docker run \
-d \
-e ENV_DOCKER_REGISTRY_HOST=ENTER-YOUR-REGISTRY-HOST-HERE \
-e ENV_DOCKER_REGISTRY_PORT=ENTER-PORT-TO-YOUR-REGISTRY-HOST-HERE \
-e ENV_USE_SSL=yes \
-v $PWD/server.crt:/etc/apache2/server.crt:ro \
-v $PWD/server.key:/etc/apache2/server.key:ro \
-p 443:443 \
konradkleine/docker-registry-frontend:v2
Note that the application still serves the port 80 but it is simply not exposed ;).
Enable it at your own will. When the application runs with SSL you can open your browser and navigate to https://localhost
ocker run --rm -it -p 5000:5000 -v registry-data:var/lib/registry registry:2
dcoker volumne ls
Mirror
https://github.com/mamun67/course-implementing-self-hosted-docker-registry/blob/master/mirror/docker-compose.yml
After this update the registry mirrors on doaemon and nodes with the publicip:port
docker login localhost:5000/confidential
https://docs.docker.com/registry/insecure/#troubleshoot-insecure-registry
Running a Docker Private Registry on EC2
https://www.elastic.io/running-a-docker-private-registry-on-ec2/
cat ~/.docker/
docker container ps --format 'table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Mounts}}'
docker image rm -node
time docker image pull node
update registry mirror
-- to list the docker iamges
docker images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment