bash - How can I run a docker container and commit the changes once a script completes? -


i want set cron job run set of commands inside docker container , commit changes docker image. i'm able run container daemon , container id using command:

container_id=$(sudo docker run -d my-image /bin/sh -c "sleep 10")

but i'm having trouble second part--committing changes image once sleep 10 command completes. there way me tell when docker container killed , run command before is?

edit: alternative, there way trigger ctrl-p-q via shell script in container leave container running return host?

run in foreground, not daemon. when ends script launched takes control , commits/push it


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -