Docker Community Forums

Share and learn in the Docker community.

how to mount “-v //var/run/docker.sock://var/run/docker.sock” in node.js with docker-api


#1

i want to mount the docker.socket. in node.js like -v //var/run/docker.sock://var/run/docker.sock .

I’m using this https://www.npmjs.com/package/node-docker-api libary. My code is:

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));

Error: watchtower couldn’t start, because:

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

how do i mount the docker.socket right?

thank you for your help :slight_smile: