Automating docker commit and push

We have application running in a docker container. We would like to save backup of container every day. And I think docker commit and docker push is one of the option to take backup and push the new image into docker hub.

But this has to be done manually.
Does docker provides a way to do this (commit and push) automatically? Or is there any open source tool to do that?

  • What is the overhead of creating docker images?
  • Why are my mounted docker volume files turning into folders inside the container?
  • how process static file when deploying django using docker and aws eb
  • Docker Node JS set env
  • PHP echo statement with URL parameter
  • Docker compose fails to setup container links properly
  • Or do we need to write scripts and add it in cron job?

    I came through this SO. But the answer is based on docker events. It is little complicated for my job. Is there any simple way?

  • Docker Java 8 Container with Heavy CPU Usage
  • What does “attach to standard streams” mean in docker?
  • How to build docker image frome .drone.yml?
  • Configuring ELK with Kitematic - Elastic Search won't start - localhost not available
  • Docker and Windows - Problems with SSH on default container
  • Docker File: Chmod on Entrypoint Script
  • One Solution collect form web for “Automating docker commit and push”

    I would recommend you to not do that :). This would result indeed in snapshots, but you endup with a long running container that can’t be restarted from origin from the snapshot. Also this will result in bigger and bigger snapshots over time.

    A better way to approach this would be to control your state and either use volumes and simply do a cron job to tar/backup that volume (you can take a look at at https://github.com/tutumcloud/dockup to make it automatic).

    An other way would be to still control your state and periodically perform a docker cp to extract your state.

    That way your container itself is stateless and can be reused easily from the original point or any point in time via that backup. It simplified a lot upgrades.

    If you don’t control your state, then you are right, commit/push would be a solution, but I’d recommend to stop the container and restart from the commit version. That way, next time, the snapshot will contains only the diff from the previous one. To do so, you will need to write your own script and add it to a cronjob.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.