<p>I think the question about Docker security in general was already well answered in other places, for example here: <a href="https://stackoverflow.com/questions/40844197/what-is-the-docker-security-risk-of-var-run-docker-sock">https://stackoverflow.com/questions/40844197/what-is-the-docker-security-risk-of-var-run-docker-sock</a></p>

<p>In your particular instance, I see the following points:</p>

<ol>
<li>The tests should run on some testing server, possibly even in a VM that is destroyed/reset after each test run, so possible accidents/incidents should not affect other systems</li>
<li>For an attacker to use this setup, they would probably (depending on your tests) need to be able to modify your test code and if they are able to do so, you will already have much bigger problems than privileged Docker access</li>
</ol>

CC BY-SA 4.0
2019-07-15T18:19:38.660Z
2019-07-15T18:19:38.660Z
user3151902
<p>I have a discussion with our DevOps about using <a href="https://www.testcontainers.org/" rel="nofollow noreferrer">Testcontainers</a> for integration tests. It's a tool to bring up throw-away containers for testing. The testcontainers need a environment variable <code>DOCKER_HOST=tcp://127.0.0.1:2375</code> to communicate with Docker.</p>

<p>He refuses to set this environment variable explaining to me that he don't want to application communicate with Docker for security reasons.</p>

<p>I've make a point that tool is designed to interact with Docker when running tests.</p>

<p>So here is my questions:</p>

<ul>
<li>Are there security considerations in this regard?</li>
<li>What more convincing arguments can I bring?</li>
</ul>

<docker><continuous-integration><security><microservices><integration>
Are using TestContainers safe for integration tests?
Edgar Asatryan
# Are using TestContainers safe for integration tests?

(Asked by: username_0 on 2019-07-15)

I have a discussion with our DevOps about using [Testcontainers](https://www.testcontainers.org/) for integration tests. It's a tool to bring up throw-away containers for testing. The testcontainers need a environment variable `DOCKER_HOST=tcp://127.0.0.1:2375` to communicate with Docker.

He refuses to set this environment variable explaining to me that he don't want to application communicate with Docker for security reasons.

I've make a point that tool is designed to interact with Docker when running tests.

So here is my questions:

* Are there security considerations in this regard?
* What more convincing arguments can I bring?

**Tags:** docker, continuous-integration, security, microservices, integration


---

## 1 answers

### Answer by username_1 on 2019-07-15. Score: 1 | Accepted answer

I think the question about Docker security in general was already well answered in other places, for example here: <https://stackoverflow.com/questions/40844197/what-is-the-docker-security-risk-of-var-run-docker-sock>

In your particular instance, I see the following points:

1. The tests should run on some testing server, possibly even in a VM that is destroyed/reset after each test run, so possible accidents/incidents should not affect other systems
2. For an attacker to use this setup, they would probably (depending on your tests) need to be able to modify your test code and if they are able to do so, you will already have much bigger problems than privileged Docker access


---

