在上次 Ubuntu 18.04 更新后损坏 Docker

Broken Docker after last Ubuntu 18.04 update

在上次 Ubuntu 更新后,有人对 Docker 有疑问吗?我有 2 个项目,我 运行 通过 docker-compose 在 ubuntu18.04 中编写。两个项目都运行良好,但在 *.yml 中发生 0 次更改后,我现在开始收到此错误。

 internal/fs/utils.js:230
    throw err;
    ^

Error: EACCES: permission denied, open '/usr/local/lib/node_modules/npm/bin/npm-cli.js'
    at Object.openSync (fs.js:461:3)
    at Object.readFileSync (fs.js:363:35)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1166:22)
    at Module.load (internal/modules/cjs/loader.js:996:32)
    at Function.Module._load (internal/modules/cjs/loader.js:896:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path: '/usr/local/lib/node_modules/npm/bin/npm-cli.js'
}
ERROR: Service 'streaming-api' failed to build: The command '/bin/sh -c npm config set unsafe-perm true' returned a non-zero code: 1

我尝试了一些命令来更改 Docker 中的权限,但没有任何帮助。

它再次与 Docker 版本 19 一起工作,如 similar question of David. The answer is from oussama faleh 中的回答所述。

这是我在 Ubuntu 18.04 上安装 docker 版本 19 的步骤:

sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get install     apt-transport-https     ca-certificates     curl     gnupg-agent     software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
docker -v