Creating a local registry
> vi docker-compose.yml
docker-compose.yml
version: '3.0' services: registry: image: registry:2 container_name: registry ports: - '5000:5000' volumes: - $HOME/registry:/var/lib/registry
> docker-compose up
Accessing the local registry
By default the username and password are 'username' and 'password'
Login to your registry
> docker login -u username -p password localhost:5000
Pushing images to your local registry
To push your images to a registry, you must first tag the image with the address of your registry:
> docker tag <image>:<tag> localhost:5000/<image>:<tag>
Once you have tagged your image, you can push it
> docker push localhost:5000/<image>:<tag>
example:
$ docker tag registry:2 localhost:5000/myreg:mytag $ docker push localhost:5000/myreg:mytag The push refers to repository [localhost:5000/myreg] 6b263b6e9ced: Pushed dead8a13b621: Pushed 00a8ff67f927: Pushed 2b7bd2eefde2: Pushed a120b7c9a693: Pushed mytag: digest: sha256:a25e4660ed5226bdb59a5e555083e08ded157b1218282840e55d25add0223390 size: 1364