Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get version of node from docker container?

Tags:

node.js

docker

To get a node version - I expect to run the following:

node --version

I'm running the following with docker:

docker run node:4-onbuild -v

I get this:

docker: Error response from daemon: Container command '--version' not found or does not exist..

My question is: How to get version of node from docker container?

like image 442
hawkeye Avatar asked Nov 20 '22 02:11

hawkeye


1 Answers

you need to specifically ask docker to run -v within the node container like below

docker run -it --rm node /bin/bash -c 'node --version'
like image 75
Kannaj Avatar answered Nov 23 '22 23:11

Kannaj