I'd like to have some kind of "development docker image" in which npm install is executed every time I restart my Docker Container (becuase I don't want to build, push and pull the new dev image every day from my local machine to our Docker server).
So I thought I could do sth. like this in my Dockerfile:
CMD npm install git+ssh://[email protected]/my/project.git#develop && npm start
Sadly, this doesn't work. The container stops immediately after docker start and I don't know why, because this works:
RUN npm install git+ssh://[email protected]/my/project.git#develop
CMD npm start
(Just for testing, that's of course not what I want to have). But maybe I have some wrong perception of CMD and someone could enlighten me?
Make your CMD point to a shell script.
CMD ["/my/path/to/entrypoint.sh"]
with that script being:
#!/bin/bash
npm install git+ssh://[email protected]/my/project.git#develop
npm start
# whatever else
I find this easier for a few reasons:
docker run mycontainer /bin/bash and then execute your shell script manually. This is helpful in debuggingIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With