docker搭建registery本地版本

$ docker run -d -p 5000:5000 --restart=always --name registry registry:2

docker会显示本地没有register:2

然后会从自己的仓库查找并且卸载这个镜像,然后启动.

检查成功启动的内容:

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
efd78fe51f04        registry:2          "/entrypoint.sh /etc…"   4 minutes ago       Up 4 minutes        0.0.0.0:5000->5000/tcp   registry

 

拉取hello-world镜像:

$docker run hello-world

$ docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

创建tag:

$ docker tag hello-world localhost:5000/helloworld:latest

尝试推送:

 docker push localhost:5000/helloworld
The push refers to repository [localhost:5000/helloworld]
af0b15c8625b: Pushed
latest: digest: sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a size: 524

强制删除hello-world后,本地将不再有hello-world镜像;

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
registry            2                   f32a97de94e1        2 weeks ago         25.8MB

尝试从本地私库拉取helloworld:

$ docker pull localhost:5000/helloworld
Using default tag: latest
latest: Pulling from helloworld
1b930d010525: Already exists
Digest: sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a
Status: Downloaded newer image for localhost:5000/helloworld:latest

 

停止registry:

$docker stop registry && docker rm -v registry

 

指定本地存储位置的registry:

docker run -d -p 5000:5000 --restart=always --name registry -v /opt/data:/var/lib/registry registry:2

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值