2023更新至docker 23.0.1的問題

更新docker之後容器都暫停並出現以下錯誤

docker-compose up -d

Starting hexo-app ... error

ERROR: for hexo-app  Cannot start service app: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: unable to apply apparmor profile: apparmor failed to apply profile: write /proc/self/attr/apparmor/exec: no such file or directory: unknown

ERROR: for app  Cannot start service app: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: unable to apply apparmor profile: apparmor failed to apply profile: write /proc/self/attr/apparmor/exec: no such file or directory: unknown
ERROR: Encountered errors while bringing up the project.

問題在於Docker version 23.0.1, build a5ee5b1 需要apparmor 所以只要作業系統沒有安裝就會報錯

sudo apt install apparmor
sudo systemctl restart docker

安裝後重啓就可以運行了

這個issue是2021就提出的,但2023/02.有人提出更新到23.0.1會出錯

https://github.com/docker/for-linux/issues/1199#issuecomment-1432592259