问题描述:
闲来无事就在开发电脑上执行了下sudo apt-get upgrade 升级下软件, 升级后docker启动失败.
使用 journalctl -xeu docker.service 查看docker执行日志:
Mar 04 16:48:10 pop-os dockerd[39273]: time="2023-03-04T16:48:10.351879912+08:00" level=warning msg="Base device already exists and has filesystem ext4 on it. User specified filesystem will be ignored." storage-driver=devicemapper
Mar 04 16:48:10 pop-os dockerd[39273]: time="2023-03-04T16:48:10.399328995+08:00" level=error msg="[graphdriver] prior storage driver devicemapper is deprecated and will be removed in a future release; update the the daemon configuration and explicitly choose this storage driver to continue using it; visit https://docs.docker.com/go/storage-driver/
Mar 04 16:48:10 pop-os dockerd[39273]: time="2023-03-04T16:48:10.399328995+08:00" level=error msg="[graphdriver] prior storage driver devicemapper is deprecated and will be removed in a future release; update the the daemon configuration and explicitly choose this storage driver to continue using it; visit https://docs.docker.com/go/storage-driver/ for more information"
Mar 04 16:48:10 pop-os dockerd[39273]: time="2023-03-04T16:48:10.404671636+08:00" level=info msg="[core] [Channel #1] Channel Connectivity change to SHUTDOWN" module=grpc
Mar 04 16:48:10 pop-os dockerd[39273]: time="2023-03-04T16:48:10.404711920+08:00" level=info msg="[core] [Channel #1 SubChannel #2] Subchannel Connectivity change to SHUTDOWN" module=grpc
Mar 04 16:48:10 pop-os dockerd[39273]: time="2023-03-04T16:48:10.404731839+08:00" level=info msg="[core] [Channel #1 SubChannel #2] Subchannel deleted" module=grpc
Mar 04 16:48:10 pop-os dockerd[39273]: time="2023-03-04T16:48:10.404739619+08:00" level=info msg="[core] [Channel #1] Channel deleted" module=grpc
Mar 04 16:48:10 pop-os dockerd[39273]: failed to start daemon: error initializing graphdriver: prior storage driver devicemapper is deprecated and will be removed in a future release; update the the daemon configuration and explicitly choose this storage driver to continue using it; visit https://docs.docker.com/go/storage-driver/Mar 04 16:48:10 pop-os dockerd[39273]: failed to start daemon: error initializing graphdriver: prior storage driver devicemapper is deprecated and will be removed in a future release; update the the daemon configuration and explicitly choose this storage driver to continue using it; visit https://docs.docker.com/go/storage-driver/ for more information
Mar 04 16:48:10 pop-os systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStart= process belonging to unit docker.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Mar 04 16:48:10 pop-os systemd[1]: docker.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit docker.service has entered the 'failed' state with result 'exit-code'.
Mar 04 16:48:10 pop-os systemd[1]: Failed to start Docker Application Container Engine.
░░ Subject: A start job for unit docker.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit docker.service has finished with a failure.
░░
░░ The job identifier is 2047 and the job result is failed.
Mar 04 16:48:12 pop-os systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ Automatic restarting of the unit docker.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Mar 04 16:48:12 pop-os systemd[1]: Stopped Docker Application Container Engine.
░░ Subject: A stop job for unit docker.service has finished
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
解决方法:
从运行日志里找到关键错误信息:
Mar 04 16:48:10 pop-os dockerd[39273]: time="2023-03-04T16:48:10.399328995+08:00" level=error msg="[graphdriver] prior storage driver devicemapper is deprecated and will be removed in a future release; update the the daemon configuration and explicitly choose this storage driver to continue using it; visit https://docs.docker.com/go/storage-driver/
大致意思就是先前使用的storage driver类型devicemapper现在不推荐使用了,以后有可能以后就废弃掉了。现在都有哪些storage driver呢?可以点开后面给的链接自己看。如果要继续使用devicemapper需要显示指定。我现在就想让docker现在能运行起来先,找到对应配置项storage-driver添加到/etc/docker/dameon.json文件中.
{
"data-root": "/data3/docker",
"storage-driver": "devicemapper"
}
修改后docker就能正常启动了