Docker and commander js
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- docker, javascript, node.js
Research direction
Start with the supplied Dockerfile and compare the two pm2-runtime command forms against the reported PM2 5.1.2 argv. Read the pm2-runtime CLI entry point and the ecosystem.config.js and app.js examples, then reproduce the unknown-command errors in a Node 16 Docker container. Done means the documented invocation starts the configured app and passes its clone arguments without treating them as unsupported commands.
Written by the indexing model from the issue text.
Description
What's going wrong?
I am using CMD ["pm2-runtime", "start", "ecosystem.config.js", "--env", "production"] in my Dockerfile to run my applications in the docker via pm2
Outside of docker pm2 start ecosystem.config.js --env production works well
but in the docker, When I run pm2 log 0 I have error like error: unknown command 'start'
When I using CMD ["pm2-runtime", "ecosystem.config.js", "--env", "production"] the error is error: unknown command 'ecosystem.config.js'
How could we reproduce this issue?
app.js
const { program } = require('commander');
program
.command('clone <source> [destination]')
.description('clone a repository into a newly created directory')
.action((source, destination) => {
console.log('clone command called');
});
ecosystem.config.js
module.exports = [{
script: 'app.js',
name: 'app',
args: 'clone foo bar',
instances: 2
}
Dockerfile
FROM node:16
RUN npm install pm2 -g
CMD ["pm2-runtime", "ecosystem.config.js"]
Supporting information
--- PM2 report ----------------------------------------------------------------
Date : Tue Nov 30 2021 13:15:01 GMT+0000 (Coordinated Universal Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 5.1.2
node version : 16.13.0
node path : not found
argv : /usr/local/bin/node,/usr/local/bin/pm2-runtime,start,ecosystem.config.js,--env,production
argv0 : node
user : undefined
uid : 0
gid : 0
uptime : 0min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 5.1.2
node version : 16.13.0
node path : not found
argv : /usr/local/bin/node,/usr/local/bin/pm2,report
argv0 : node
user : undefined
uid : 0
gid : 0
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz
cpus nb : 4
freemem : 3189035008
totalmem : 9893634048
home : /root
===============================================================================
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
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.
More from Unitech/pm2
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
-
Errors Open
Difficulty 4/5 3-5 days Newbie friendliness 28/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100