You can also achieve everything in the compose file through cli arguments to docker. I wouldn't recommend using the cli like that though; the compose file keeps things repeatable.
I would recommend people learning docker learn how to use the cli to achieve what docker compose does, it'll help you understand what's going on underneath.
Can you share the equivalent cli command? I would share it in the article
docker run -v `pwd`:/app -p 8900:8900 node:12 sh -c "npm install && npm start"
In general, even though it might sound rude, but docs.docker.com/engine/reference/c... is pretty exhaustive and should be read first.
Nevertheless your approach to go for a docker compose solution helps to make it better portable also for other users/developer of your code.
Thank you for covering for me! I only just saw the reply comment. In addition to that you will need -w /app to change the working directory.
For completeness for anyone else reading,
sh -c "..."
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.