docker 注册表
In this story, we will install Docker Registry on a VM and the cloud and we will add a Docker container to browser the registries from a web browser. From my side, I created an ECS instance on Alibaba Cloud. But we could do it everywhere. After creating the ECS instance, I got its public IP address (8.208.91.39
) and I created a security group to authorize the following ports:
在这个故事中,我们将在虚拟机和云上安装Docker Registry,并将添加Docker容器从Web浏览器浏览注册表。 就我而言,我在阿里云上创建了ECS实例。 但是我们可以在任何地方做。 创建ECS实例后,我获得了其公用IP地址( 8.208.91.39
),并创建了一个安全组来授权以下端口:
5000
for the Docker Registry,5000
用于Docker Registry,8086
for the Docker Registry UI.Docker Registry UI的
8086
。
设置Docker和Docker Compose (Set up Docker and Docker Compose)
On the VM, if Docker and Docker Compose are not installed, install them:
在VM上,如果未安装Docker和Docker Compose,请安装它们:
- Docker: 码头工人:
yum install -y yum-utilsyum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repoyum install -y docker-ce docker-ce-cli containerd.iosystemctl start docker
- Docker Compose: Docker撰写:
curl -L "https://github.com/docker/compose/releases/download/1.27.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-composechmod +x /usr/local/bin/docker-composeln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
I ran these commands as root
.
我以root
身份运行了这些命令。
Let’s verify that Docker and Docker Compose are well installed:
让我们验证Docker和Docker Compose的安装是否正确:
docker run hello-worlddocker-compose --version
设置Docker Registry和Docker Registry UI (Set up Docker Registry and Docker Registry UI)
Let’s install a Docker Registry from a Docker image.
让我们从Docker映像安装Docker注册表。
Create a docker_registry
directory:
创建一个docker_registry
目录:
mkdir docker_registrycd docker_registry
Download the image registry:2
:
下载映像registry:2
:
docker pull registry:2
The output is:
输出为:
2: Pulling from library/registrycbdbe7a5bc2a: Pull complete47112e65547d: Pull complete46bcb632e506: Pull completec1cc712bcecd: Pull complete3db6272dcbfa: Pull completeDigest: sha256:8be26f81ffea54106bae012c6f349df70f4d5e7e2ec01b143c46e2c03b9e551dStatus: Downloaded newer image for registry:2docker.io/library/registry:2
Create a directory to store the Docker images in /tmp/docker_registry
:
创建一个目录以将Docker映像存储在/tmp/docker_registry
:
mkdir /tmp/docker_registry
Launch Docker Registry by exposing the ports from5000/tcp
to 8888/tcp
on the host:
通过在主机上公