如何使用docker-api在node.js中挂载“ -v //var/run/docker.sock://var/run/docker.sock”

时间:2019-01-11 14:06:33

标签: node.js api sockets docker

我想挂载docker.socket。在node.js中,例如-v //var/run/docker.sock://var/run/docker.sock

我正在使用此https://www.npmjs.com/package/node-docker-api库。 我的代码是:

dockerStart.container
  .create(
     { name: "watchtower",
       Image: "v2tec/watchtower",
       Volumes:{"/var/run/docker.sock":{'/var/run/docker.sock'}}
     })
  .then(container=>container.start())
  .catch(error => console.log(error));

错误:watch望塔无法启动,因为:

"Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"

如何正确安装docker.socket?

感谢您的帮助:)

0 个答案:

没有答案
相关问题