docker permission denied
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
What's going wrong?
docker permission denied when use child_process.exec('docker restart xxx')
How could we reproduce this issue?
Supporting information
At first, deployer user is not in root:docker, so added.
then 'node app.js' is ok, but start with 'pm2 start app.js' still wrong
Error: Command failed: docker restart offlinechinamap_tileserver_1
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/offlinechinamap_tileserver_1/restart": dial unix /var/run/docker.sock: connect: permission denied
at ChildProcess.exithandler (node:child_process:412:12)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1091:16)
at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
code: 1,
killed: false,
signal: null,
cmd: 'docker restart offlinechinamap_tileserver_1'
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the environment for node app.js with the one used by pm2 start app.js, focusing on the child_process.exec('docker restart xxx') entry point and access to /var/run/docker.sock. Confirm that the Docker restart command works under PM2 with the deployer user; the issue provides no project file or test to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, javascript, node.js
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100