最近在做postgres数据库升级,计划从9.6升级到12,先用docker启动pg12。在启动docker 20的版本中运行正常,但是在docker 18中出了些问题。
1. Error response from daemon: configured logging driver does not support reading
- [root@db_slave2 pg12]# docker logs 610bf6961887
- Error response from daemon: configured logging driver does not support reading
尝试重启日志服务,但没有仍然报错
- [root@db_slave2 data]# systemctl restart systemd-journald
- [root@db_slave2 data]# systemctl status systemd-journald
检查docker 配置驱动,发现docker 驱动使用了"log-driver": "gelf",将日志指向第三方日志采集,于是将docker 启动添加参数 --log-driver ,指定驱动为json-file
即 --log-driver=json-file
2. cannot access '/docker-entrypoint-initdb.d/': Operation not permitted
- [root@db_slave2 data]# docker logs 909908659c3b
- ls: cannot access '/docker-entrypoint-initdb.d/': Operation not permitted
从报错来看是权限不足,于是参过在docker run时参数 --privileged问题解决
即
docker run -d --name postgres12 -v /data/pg12:/var/lib/postgresql/data --log-driver=json-file --privileged postgres:12