利用docker搭建本地私有镜像仓库

主机名 角色
sht-sgmhadoopcm-01 Docker Repository

sht-sgmhadoopnn-01

Docker Client

1. 在两台节点分别安装docker

https://www.cnblogs.com/ilifeilong/p/11687143.html

2. cm-01节点下载docker官方提供的registry镜像

# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE


# docker search registry
NAME                                 DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
registry                             The Docker Registry 2.0 implementation for s…   2725                [OK]                
.................

# docker pull registry
Using default tag: latest
latest: Pulling from library/registry
c87736221ed0: Pull complete 
1cc8e0bb44df: Pull complete 
54d33bcb37f5: Pull complete 
e8afc091c171: Pull complete 
b4541f6d3db6: Pull complete 
Digest: sha256:8004747f1e8cd820a148fb7499d71a76d45ff66bac6a29129bfdbfdc0154d146
Status: Downloaded newer image for registry:latest
docker.io/library/registry:latest

# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
registry            latest              f32a97de94e1        7 months ago        25.8MB

3.cm-01新建容器

# docker run --detach --publish 5000:5000 --name registry-container --hostname registry registry
191a5a61a411b4ffc3a2edb43c3b675d30c2e52365044333f065297af02b9a81
# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
191a5a61a411        registry            "/entrypoint.sh /etc…"   7 seconds ago       Up 5 seconds        0.0.0.0:5000->5000/tcp   registry-container

猜你喜欢

转载自www.cnblogs.com/ilifeilong/p/11708183.html