简体   繁体   中英

How to run python scripts and do CMD in Dockerfile for the docker container

I have an image with a custom Dockerfile. When I start the container, I want to run CMD ["npm, "start"] but right before that, I need to run three scripts.

I've tried:

1)putting the python scripts followed by npm start in a .sh script, and running CMD ["script-location/script.sh"]

2) calling CMD ["script", "npm", "start"]

none of this is working, and after the python scripts run, the container shuts down instead of running npm start and listening at a port. Not sure how to fix this.

the bash script I have is:

#!/bin/bash

echo starting to run runtime_properties...
python /var/first_script.py
echo finished runtime_properties

echo starting to run runtime_properties...
python /var/second_script.py
echo finished runtime_files

echo starting to run config-dns-props...
python /var/third_script.py
echo finishing config runtime files

echo starting to run npm start...
npm start

必须运行ENTRYPOINT ["script-path/script.sh"]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM