# Run a local registry on port 5000
docker run -d -p 5000:5000 --restart always --name registry registry:2
# Test pushing the alpine image to the local registry
docker pull alpine
docker tag alpine localhost:5000/alpine
docker push localhost:5000/alpine
# View the repositories
http://localhost:5000/v2/_catalog
# View the images in a repository
http://localhost:5000/v2/alpine/tags/list
version: '3'
services:
registry:
image: registry:2
container_name: registry
restart: always
ports:
- 5000:5000
volumes:
- registry-data:/var/lib/registry
environment:
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
depends_on:
- auth
auth:
image: httpd:2.4
container_name: auth
restart: always
ports:
- 8080:80
volumes:
- ./auth:/usr/local/apache2/htdocs/
command: /usr/local/apache2/bin/httpd -DFOREGROUND
volumes:
registry-data: