harbor关闭异常问题处理

Posted 我爱看明朝

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了harbor关闭异常问题处理相关的知识,希望对你有一定的参考价值。

harbor关闭异常问题处理

错误信息

当执行 docker-compose down -d 关闭harbor 时,提示无法关闭,提示信息如下:

ERROR: network harborv21_harbor id a65b5375c996c2ac54cbbc69c66aa169cd69b0c583ee0f1e1d913d591c3b19a2 has active endpoints

这是因为有组件的网络链接无法关闭,执行以下命令关闭组件的网络连接。

1.查看harbor组件之间的网络通信

 docker network inspect a65b5375c996c2ac54cbbc69c66aa169cd69b0c583ee0f1e1d913d591c3b19a2

输出以下信息

[
    {
        "Name": "harborv21_harbor",
        "Id": "a65b5375c996c2ac54cbbc69c66aa169cd69b0c583ee0f1e1d913d591c3b19a2",
        "Created": "2021-01-15T11:48:26.540664575+08:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "169.18.0.1/16",
                    "Gateway": "169.18.0.2"
                }
            ]
        },
        "Internal": false,
        "Attachable": true,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "056542706bc1e8ecc269406c1fafe9a9e674b66e38cd195f349710a7378f0d6e": {
                "Name": "registry",
                "EndpointID": "9b7b0ff27bd1df503a08eb1fee15de93a2566ac69aa751bf49f3659c19213c2b",
                "MacAddress": "02:42:ac:12:00:04",
                "IPv4Address": "167.18.0.4/16",
                "IPv6Address": ""
            },
            "37dac9199b95a47aac962c8f90daf3157e0affc50480971b6415c7e9af795a34": {
                "Name": "harbor-db",
                "EndpointID": "704e4a9fdb16289a4b3ec0c9be0cba02e5f7a8b999d8aa5d848e73a3b9c2ec9e",
                "MacAddress": "02:42:ac:12:00:06",
                "IPv4Address": "167.18.0.6/16",
                "IPv6Address": ""
            },
            "495c1cc4b43bcaa169bbe86e7bf8d169cd864e8e9164118c8e6ca4c7c738e24a": {
                "Name": "redis",
                "EndpointID": "faf9e8f1e4ceafd9080d8cdaa41c22573e4caa75fce352367967c4f46f1f8299",
                "MacAddress": "02:42:ac:12:00:05",
                "IPv4Address": "167.18.0.5/16",
                "IPv6Address": ""
            },
            "5c4ce4c005b74f44ae02615ea143a109f166e1c539fa139460c466d7e8a2a20d": {
                "Name": "harbor-jobservice",
                "EndpointID": "1c051b689f0e1feab64f417f2d88f0ad742da8a6f25e34958c10ef22e100ff7e",
                "MacAddress": "02:42:ac:12:00:09",
                "IPv4Address": "167.18.0.9/16",
                "IPv6Address": ""
            },
            "62b385c9fdec01dab579a868fd4b08840bd04f04b643c8046081414805a22185": {
                "Name": "harbor-log",
                "EndpointID": "3a32b660bf2cbe327ee70947a965feacf7422ba87c44d39d46878bb3887ad751",
                "MacAddress": "02:42:ac:12:00:02",
                "IPv4Address": "167.18.0.2/16",
                "IPv6Address": ""
            },
            "bbea4ea4d83cc4d925fa665b3e2cf1f0a4eed73f76bf95d03d23e105b7813dcc": {
                "Name": "harbor-portal",
                "EndpointID": "904065dcabb6deedf49c78acc63546ef9be426b06a7e41a193682cd6008714df",
                "MacAddress": "02:42:ac:12:00:07",
                "IPv4Address": "167.18.0.7/16",
                "IPv6Address": ""
            },
            "db3714825d4fc175e9d8bfe21757145946c31c27c944c9af457c42c18a65751d": {
                "Name": "registryctl",
                "EndpointID": "6917e8010692d54a24f60fdbfe6513ad68b3ffb574d85222a07e5e2f10cccc6f",
                "MacAddress": "02:42:ac:12:00:03",
                "IPv4Address": "167.18.0.3/16",
                "IPv6Address": ""
            },
            "db5d05035a4fbb5970c45ea2904381ee31d3023e5f05bfbf52d2e62974777f39": {
                "Name": "nginx",
                "EndpointID": "08cc918c66736d5bb94c5c3d831f5eef95e6ba7f2cd59117eca4f76bd94f00cb",
                "MacAddress": "02:42:ac:12:00:0a",
                "IPv4Address": "167.18.0.10/16",
                "IPv6Address": ""
            },
            "eab4ce144c60cadccb6085dd4ebf253e579d4d3f2f2bef23cf6c0c168922f823": {
                "Name": "harbor-core",
                "EndpointID": "1c0b7e8901d4fd15ee48c2000b433dbf108aaaf6b7b8cec6f83a5a27d204f3dd",
                "MacAddress": "02:42:ac:12:00:08",
                "IPv4Address": "167.18.0.8/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "harbor",
            "com.docker.compose.project": "harborv21",
            "com.docker.compose.version": "1.26.0-rc3"
        }
    }
]

2.关闭harbor组件的网络连接

如上面输出信息,执行下面命令关闭网络连接

  docker network disconnect -f  Id  Containers.Name 
  docker network disconnect -f  Name  Containers.Name 


docker network disconnect -f a65b5375c996c2ac54cbbc69c66aa169cd69b0c583ee0f1e1d913d591c3b19a2  registry
docker network disconnect -f a65b5375c996c2ac54cbbc69c66aa169cd69b0c583ee0f1e1d913d591c3b19a2  harbor-db
docker network disconnect -f a65b5375c996c2ac54cbbc69c66aa169cd69b0c583ee0f1e1d913d591c3b19a2  redis
docker network disconnect -f a65b5375c996c2ac54cbbc69c66aa169cd69b0c583ee0f1e1d913d591c3b19a2  harbor-jobservice
docker network disconnect -f a65b5375c996c2ac54cbbc69c66aa169cd69b0c583ee0f1e1d913d591c3b19a2  harbor-log
docker network disconnect -f a65b5375c996c2ac54cbbc69c66aa169cd69b0c583ee0f1e1d913d591c3b19a2  harbor-portal
docker network disconnect -f a65b5375c996c2ac54cbbc69c66aa169cd69b0c583ee0f1e1d913d591c3b19a2  registryctl
docker network disconnect -f a65b5375c996c2ac54cbbc69c66aa169cd69b0c583ee0f1e1d913d591c3b19a2  nginx
docker network disconnect -f a65b5375c996c2ac54cbbc69c66aa169cd69b0c583ee0f1e1d913d591c3b19a2  harbor-core

或这个也可以删除


docker network disconnect -f harborv21_harbor  registry
docker network disconnect -f harborv21_harbor  harbor-db
docker network disconnect -f harborv21_harbor redis
docker network disconnect -f harborv21_harbor  harbor-jobservice
docker network disconnect -f harborv21_harbor  harbor-log
docker network disconnect -f harborv21_harbor  harbor-portal
docker network disconnect -f harborv21_harbor  registryctl
docker network disconnect -f harborv21_harbor  nginx
docker network disconnect -f harborv21_harbor  harbor-core

4. 检查是否可以正确关闭

之后再docker-compose down -d 后在看下dokcer ps各组件是否正确关闭,

如有组件是 unhealthy的状态,

5. 有组件是unhealthy的则删除容器

 docker rm --force containerName

使用上面命令,删除unhealthy的镜像。

6.再检查harbor的所有组件是否已经关闭

之后再docker ps 直到harbor的组件都完全关闭了。

7.再次启动harbor的所有组件

执行docker-compose up -d 启动harbor

8.启动成功,验证harbor后台是否正常,镜像推拉是否正常

再次查看组件是否正常启动,穿透到单台harbor看是否正常;

验证push/pull, 穿透到对应的harbor,找到镜像,测试push/pull。

之后推拉测试机上删除测试拉下来的镜像。

以上是关于harbor关闭异常问题处理的主要内容,如果未能解决你的问题,请参考以下文章

Harbor故障排查篇Harbor jobservice组件异常问题处理

rootView上的Android片段空指针异常[关闭]

异常和TCP通讯

关闭从另一个对话框片段启动的对话框片段会导致非法状态异常

PCL异常处理:pcl 1.8.13rdpartyoostincludeoost-1_64oost ypeofmsvc ypeof_impl.hpp(125): error(代码片段

使用片段中的处理程序时出现非法状态异常