一、今天遇到一个问题,habor不能用了,经查看发现有几个容器异常,docker-compose restart 报如下错误

[root@docker-121 harbor]# docker-compose restart
Restarting nginx              ... done
Restarting harbor-portal      ... done
Restarting harbor-jobservice  ... done
Restarting harbor-core        ... error
Restarting redis              ... error
Restarting registryctl        ... done
Restarting registry           ... done
Restarting harbor-db          ... done
Restarting harbor-adminserver ... error
Restarting harbor-log         ... done

ERROR: for harbor-core  b'Cannot restart container befeaa491460cf4499145f45fe8d551d30fdcebd12c6c6cf3476312f7652655e: OCI runtime create failed: container with id exists: befeaa491460cf4499145f45fe8d551d30fdcebd12c6c6cf3476312f7652655e: unknown'

ERROR: for redis  b'Cannot restart container 13f207ad59f93d0b3e620cf140d59fd03241440ce74008619f76310d2531aa50: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refused'

ERROR: for harbor-adminserver  b'Cannot restart container 3abc06de3d8b808882ea6cfe0be474783740b6b9758e72f758c9dd1ac56c1f81: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refused'

解决过程:

1、harbor-core

查找harbor-core的ID内容,删掉涉及runtime-runc的,重启即可
[root@docker-121 harbor]# find / -name befeaa491460cf4499145f45fe8d551d30fdcebd12c6c6cf3476312f7652655e
/run/docker/runtime-runc/moby/befeaa491460cf4499145f45fe8d551d30fdcebd12c6c6cf3476312f7652655e
/var/lib/docker/containers/befeaa491460cf4499145f45fe8d551d30fdcebd12c6c6cf3476312f7652655e
/var/lib/docker/image/overlay2/layerdb/mounts/befeaa491460cf4499145f45fe8d551d30fdcebd12c6c6cf3476312f7652655e
[root@docker-121 harbor]# mv /run/docker/runtime-runc/moby/befeaa491460cf4499145f45fe8d551d30fdcebd12c6c6cf3476312f7652655e /tmp/

2、dial tcp 127.0.0.1:1514: connect: connection refused

  类似这个问题多重启几次即可