Search code examples
molecule

How not to destroy container upon failure


Is there a way to have molecule not destroy the docker container that was created upon a failure?

I have the following scenario in molecule.yml:

scenario:
  name: default
  test_sequence:
    - create
    - converge
    - verify

One of the testinfra test is failing and I'd like to inspect the container after the failure (docker exec -it xxxx /bin/bash).

However, molecule keeps on cleaning up the container:

An error occurred during the test sequence action: 'verify'. Cleaning up.
--> Scenario: 'default'
--> Action: 'destroy'

Solution

  • the --destroy never flag should be used (e.g. molecule test --destroy never).