apocas / dockerode

Docker + Node = Dockerode (Node.js module for Docker's Remote API)
Apache License 2.0
4.32k stars 460 forks source link

Weird EACCESS error when running a simple container #168

Closed odino closed 7 years ago

odino commented 9 years ago

Hi there, been using dockerode since ages and has been working quiite well :)

One thing I bumped into today:

var client = new Docker({socketPath: '/tmp/docker.sock'});

client.run('busybox', ['uname'], process.stdout, function (err, data, container) {
  console.log(err, err.stack, data)
})

results in:

server_1   | { [Error: read EACCES] code: 'EACCES', errno: 'EACCES', syscall: 'read' } 'Error: read EACCES\n    at exports._errnoException (util.js:746:11)\n    at Pipe.onread (net.js:559:26)' null
server_1   | Linux

This happens when Im connecting to docker from another container -- I share the docker socket with -v /var/run/docker.sock:/tmp/docker.sock. If I run the same code on the host works perfectly:

Linux
null { StatusCode: 0 }

Any idea? When I get the error seems like output is streamed correctly to the stdout, but I receive no data / statuscode / etc when the container is done -- just that weird EACCESS error.

odino commented 9 years ago

Forgot to mention, running the same 2 snippets on another machine works perfectly -- on the host and in a container. So Im trying to figure out what the problem is (ie. docker config, etc). If you have any pointer it would be great :)

kapolos commented 8 years ago

Use the --privileged flag when running your container.

odino commented 8 years ago

Nothing changes -- also I wouldnt be comfortable running the container as privileged :)

LaurensRietveld commented 7 years ago

Perhaps a relevant note: the user in the container should be assigned to the docker group as well. The docker group should have the same group ID as on the host