diff --git a/imagefiles/dockcross b/imagefiles/dockcross index b7823f7..1776c52 100755 --- a/imagefiles/dockcross +++ b/imagefiles/dockcross @@ -205,10 +205,17 @@ docker run $TTY_ARGS --name $CONTAINER_NAME \ $FINAL_IMAGE "$@" run_exit_code=$? -# Deleting the container while ignoring error is required because of -# https://circleci.com/docs/docker-btrfs-error/. -# See issue dockcross/dockcross#50 for more details. -docker rm -f $CONTAINER_NAME > /dev/null || true +# Attempt to delete container +rm_output=$(docker rm -f $CONTAINER_NAME 2>&1) +rm_exit_code=$? +if [[ $rm_exit_code != 0 ]]; then + if [[ "$CIRCLECI" == "true" ]] && [[ $rm_output == *"Driver btrfs failed to remove"* ]]; then + : # Ignore error because of https://circleci.com/docs/docker-btrfs-error/ + else + echo "$rm_output" + exit $rm_exit_code + fi +fi exit $run_exit_code