I am working on an Flask REST API developed with Docker and I want to automate the whole process by which I start the application.
The whole starting process involves (on Windows):
open cmd prompt
enter docker exec -it container_name bash
inside the container, run python main.py
Is there a way to create a bash script to run these 3 commands and keep the container window open so I can see the API logs (and run other commands)?
Thank you.
you could use something like this
#!/usr/bin/env bash
docker run -it container_name python:3 python main.py
你可以试试这个:
docker exec -it container_name bash -c 'python main.py; read -p"Enter to close window"'
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.