I have written an app which connect to an already created unix.sock file and get some data from it. But I am getting EACCES error while try to connect. Error message is given below.
{ Error: connect EACCES /home/unix.sock
at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
errno: 'EACCES',
code: 'EACCES',
syscall: 'connect',
address: '/home/unix.sock' }
code snippet.
var socket = net.createConnection("/home/unix.sock")
.on("connect", function() {
console.log("Connected");
socket.write(req1);
socket.write(req2);
})
.on("data", function (data) {
data = JSON.parse(data);
console.log("Response from server: %s", data.response);
// Close the connection
socket.end();
})
.on('error', function(data) {
console.log(data);
})
Any idea about why this error occurs? I think it is because of the non root container. Is there anyway I can get rid of this error with non root container?