< 5 Docker Compose | 7 Docker Engine, Storage and Networking >
56% Complete
32: Docker Registry
https://www.udemy.com/learn-docker/learn/lecture/15829070#content
Images
Images are pulled from the Docker repository
docker pull location/username/imagename docker pull imagename
is the same as
docker pull docker.io/imagename/imagename
As such:
- The Docker repository is assumed because none was defined.
- The username is the same as the image name.
Private Registry
Your organization may require a private registry so your images are not accessible to the public.
- AWS and Google both provide private registries.
Private Registry Login
docker login private-registry.tld Username: registry-user Password: *******
docker run private-registry.tld/apps/internal-app
It is important to note that you MUST log in before pulling an image or Docker will report that the image cannot be found.
You can create your own local registry
docker run -d -p 5000:5000 --name registry registry:2
Pushing Images to your local repository
1. Tag the image with the URL of the registry
docker image tag my-image localhost:5000/my-image
- You can replace ‘localhost’ with the URL or IP address of the Docker Registry you created.
2. Push the image
docker push localhost:5000/my-image
Create Your Own Local Registry
No lab, self created project
Create the storage location on your hdd
sudo mkdir -p /var/lib/thomas/docker/registry chown thomas:thomas /var/lib/thomas/docker/registry
Create the Docker Compose file
registry: image: registry:@ ports: - 5000:5000 volumes: - /var/lib/thomas/docker/registry:/var/lib/registry
Start It
docker-compose up -d