版本信息:
harbor:v1.10.2
docker: 19.03.9
docker-compose : 1.23.2
启动报错现象
docker-copmose up -d 后 harbor-log 无限重启
查看 harbor-log日志
docker logs -f harbor-log
sudo: unable to change expired password: Authentication token manipulation error
sudo: Account or password is expired, reset your password and try again
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
Changing password for root.
解决方法:
1.以tar形式导出容器
mkdir -p /tmp/harbor-log
cd /tmp/harbor-log
docker export harbor-log -o harbor-log.tar
2.解压tar包,修改shadow中的权限(有想深入了解的可以百度“关于/etc/shadow 文件”)
# 解压tar包
tar xvfp harbor-log.tar
# 修改shadow文件的值
sed -i 's/:90:/:99999:/g' /tmp/harbor-log/etc/shadow
3.将修改后的shadow文件挂载到harbor-log容器内
mkdir /root/data/harbor/harbor-log-etc
cp /tmp/harbor-log/etc/shadow /root/data/harbor/harbor-log-etc/shadow
4.修改docker-compose.yml中harbor-log容器volumes配置,增加如下内容
- type: bind
source: ./harbor-log-etc/shadow
target: /etc/shadow
5.重新启动harbor
docker-compose down
docker-compose up -d