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

后端 未结 4 756
南旧
南旧 2021-02-14 23:01

I want to set up a cron job to run a set of commands inside a docker container and then commit the changes to the docker image. I\'m able to run the container as a daemon and ge

4条回答
  •  一个人的身影
    2021-02-14 23:42

    Try this if you want an auto commit for all which are running. Put this in a cron or something, if this helps

    #!/bin/bash
    for i in `docker ps|tail -n +2|awk '{print $1}'`; do docker commit -m "commit new change" $i; done
    

提交回复
热议问题