Option to cleanup container if the Docker task failed to start it

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Unresolved
    • None
    • Component/s: Docker, Docker Runner
    • None
    • 0

      Summary

      When running a non-detached container in Bamboo using the Docker task, and the container fails to start, the Bamboo build will fail but the Docker container is not removed on completion of the task.

      There may be an error in the logs related to the command being executed inside the container but it will not hint that the container is not removed.

      Possible excessive disk usage may hint at the problem.

      https://confluence.atlassian.com/bamkb/docker-containers-are-not-removed-after-a-build-completes-720830717.html 

      Desired behaviour

      Cleanup the container if the Docker task failed to run.

      We would like to have an option to remove the container if the Docker Task failed to start a container.

      Workaround

      The leftover containers will not influence subsequent builds so may go unnoticed for some time. If the Docker service on the agent hasn't been restarted in a while this may lead to excessive disk usage. You can reclaim the disk space by manually removing the container using the docker rm command, for example:

      docker rm my-failed-container 

            Assignee:
            Unassigned
            Reporter:
            Vani
            Votes:
            7 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: