使用registry镜像创建私有仓库
安装Docker后,可以通过官方提供的registry镜像来简单搭建一套本地私有仓库环境:
$ sudo docker run -d -p 5000:5000 registry
这将自动下载并启动一个registry容器,创建本地的私有仓库服务。
默认情况下,会将仓库创建在容器的/tmp/registry目录下。可以通过-v参数来将镜像文件存放在本地的指定路径上。
例如下面的例子将上传的镜像放到/opt/data/registry目录:
$ sudo docker run -d -p 5000:5000 -v /opt/data/registry:/tmp/registry registry
此时,在本地将启动一个私有仓库服务,监听端口为5000。