<p>In this question: <a href="https://stackoverflow.com/questions/55631068/teamcity-build-wont-run-until-build-agents-is-configured-with-docker">Teamcity Build won&#39;t run until Build Agents is configured with Docker?</a></p>

<p>I had a problem with the teamcity-agent (Teamcity is a build server) deployment. These agents are the build runners and they come as their own pods. So back the days when I was just using Docker without K8s I used this command to run the container:</p>

<pre><code>docker run -it -e SERVER_URL="&lt;url to TeamCity server&gt;"  \
    --privileged -e DOCKER_IN_DOCKER=start \    
    jetbrains/teamcity-agent 
</code></pre>

<p>So adding those environement vars to the K8s container definition wasn't that hard. I just had to define this <code>spec</code> part:</p>

<pre><code>spec:
  containers:
    - name: teamcity-agent
      image: jetbrains/teamcity-agent:latest
      ports:
        - containerPort: 8111
      env:
        - name: SERVER_URL
          value: 10.0.2.205:8111
        - name: DOCKER_IN_DOCKER
          value: start
</code></pre>

<p>So now I want to have the <code>--privileged</code> flag as well. I found and article here <a href="https://kubernetes.io/docs/tasks/configure-pod-container/security-context/" rel="nofollow noreferrer">link to guide</a> which I did not really understood. I added</p>

<pre><code>securityContext:
  allowPrivilegeEscalation: false // also tried 'true'
</code></pre>

<p>but it did not worked with that.</p>

<p>Can someone point out where to look at?</p>

<p>I think you may use it like this</p>

<pre><code>securityContext:
  privileged: true
</code></pre>

<p>see <a href="https://kubernetes.io/docs/concepts/policy/pod-security-policy/" rel="nofollow noreferrer">this</a></p>
