# Exit code from docker run

**URL:** <https://discuss.circleci.com/t/exit-code-from-docker-run/5202>\
**Category:** Build Environment\
**Tags:** docker\
**Created:** [July 19, 2016, 1:20am UTC](https://discuss.circleci.com/t/exit-code-from-docker-run/5202 "2016-07-19T01:20:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stevevega](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@stevevega](https://discuss.circleci.com/u/stevevega)\
**Post date:** [July 19, 2016, 1:20am UTC](https://discuss.circleci.com/t/exit-code-from-docker-run/5202/1 "2016-07-19T01:20:23Z")

</div>

Hello, I’m trying to run some tests using docker as described in [https://circleci.com/docs/docker/#running-tests-in-a-container](https://circleci.com/docs/docker/#running-tests-in-a-container)

Problem is, if I add --rm I get the following error:

```auto
ERROR: Driver btrfs failed to remove root filesystem 042e94623b762e26a9197136e18ce74ffd09b4c9895d1c0b4987a9df6c010f73: Failed to destroy btrfs snapshot /var/lib/docker/btrfs/subvolumes for 042e94623b762e26a9197136e18ce74ffd09b4c9895d1c0b4987a9df6c010f73: operation not permitted

```

If I remove --rm, I’m able to complete the tests but when there is a compilation error the exit code is still 0.

How can I get the correct exit code if I’m not able to set the --rm option?

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:32am UTC](https://discuss.circleci.com/t/exit-code-from-docker-run/5202/2 "2018-06-18T11:32:10Z")

</div>

Closed on June 18, 2018, 11:32am UTC


