+get_latest_running_container
+get_old_running_container
+
+if [[ ! -z $latest_container_id ]]; then
+ DEBUG "latest container is running: $latest_container_id"
+ delete_old_container
+ delete_old_image
+ change_image_tag_2_old
+ mark_latest_container_2_old
+ pull_latest_image
+ stop_old_container
+ run_latest_image
+
+elif [[ ! -z $old_container_id ]]; then
+ DEBUG "old container is running: $old_container_id"
+ delete_latest_container
+ delete_latest_image
+ pull_latest_image
+ stop_old_container
+ run_latest_image
+else
+ DEBUG "no container is running"
+ delete_old_container
+ delete_old_image
+ delete_latest_container
+ delete_latest_image
+ pull_latest_image
+ run_latest_image