title: How to configure docker-compose.yml to up a container as root
body: <p>I'm trying to connect two containers with a docker-compose-yml, but it isn't working. This is my docker-compose.yml file:</p>
  <pre class="lang-yaml prettyprint-override"><code>version: &quot;3&quot;
  services:
      datapower:
          build: .
          ports:
              - &quot;9090:9090&quot;
          depends_on:
              - db
      db:
          image: &quot;microsoft/mssql-server-linux:2017-latest&quot;
          environment:
              SA_PASSWORD: &quot;your_password&quot;
              ACCEPT_EULA: &quot;Y&quot;
          ports:
          - &quot;1433:1433&quot;
  </code></pre>
  <p>When I make:</p>
  <blockquote>
  <p>docker-compose up</p>
  </blockquote>
  <p>This up my two containers. Then I stop one container and then I run the same container stoped independiently like:</p>
  <blockquote>
  <p>docker-compose run -u root --name nameofcontainer 'name of container named in docker-compose.yml'</p>
  </blockquote>
  <p>With this, the connection of the containers works. Exists a method to configure my docker-compose.yml to connect my containers like root without stop a container and run independently?</p>