Harbor环境搭建
wget https:/ / github. com/goharbor/harbor/releases/download/v2. 3. 4/harbor-offline-installer-v2. 3. 4. tgz
tar - zxvf harbor-offline-installer-v2. 3. 4. tgz - C / usr/local/
cp harbor. yml. tmpl harbor. yml
. / install. sh
构建镜像
vi Dockerfile
FROM nginx
RUN echo "hello world, v1" > / usr/share/nginx/html/index. html
docker build -- no-cache -- force-rm - t web:v1 .
docker tag web:v1 192. 168. 3. 80:80/repo/web:v1
镜像上传
sudo tee / etc/docker/daemon. json <<- 'EOF'
{
"exec-opts" : [ "native.cgroupdriver=systemd" ] ,
"registry-mirrors" : [ "https://du3ia00u.mirror.aliyuncs.com" ] ,
"live-restore" : true,
"log-driver" :"json-file" ,
"log-opts" : { "max-size" :"500m" , "max-file" :"3" } ,
"storage-driver" : "overlay2" ,
"insecure-registries" : [ "192.168.3.80:80" ]
}
EOF
systemctl restart docker
docker login 192. 168. 3. 80:80
docker push 192. 168. 3. 80:80/repo/web:v1
镜像拉取并发布
version: "3"
services:
web:
image: 192. 168. 3. 80:80/repo/web:v1
container_name: web
ports:
- 6000:80
docker-compose up - d
测试验证