title: What is the docker-compose equivalent of the docker argument --net=container:ReportWeb in the docker run command
body: <p>I have two containers and they connect ok when I run the following docker run commands.</p>
  <pre><code>docker run --security-opt &quot;credentialspec=file://net_app.json&quot; -d -ti --name=ReportWeb -p 8081:80 --net=nat --ip 172.30.116.101 --restart=always net.com/reportweb:1.0.0
  </code></pre>
  <p>And then</p>
  <pre><code>docker run --security-opt &quot;credentialspec=file://net_app.json&quot; -d -ti --name=Engine --net=container:ReportWeb --restart=always net.com/report:1.0.0
  </code></pre>
  <p>However can not get the same effect in docker-compose</p>
  <p>docker-compose file:</p>
  <pre><code>version: &quot;3&quot;
  services:
    reportweb:
      build:
        context: .
        dockerfile: ReportWeb.Dockerfile
      image: net.com/reportweb:1.0.0
      tty: true
      stdin_open: true
      restart: on-failure
      ports:
        - &quot;8081:80&quot;
      security_opt:
        - credentialspec=file://net_app.json
      networks:
        app_net:
          ipv4_address: 172.16.238.101
    cyengine:
      build:
        context: .
        dockerfile: Report.Dockerfile
      image: net.com/report:1.0.0
      links:
        - reportweb
      tty: true
      stdin_open: true
      restart: on-failure
      depends_on:
        - reportweb
      security_opt:
        - credentialspec=file://net_app.json
      networks:
        - app_net
  networks:
    app_net:
      ipam:
        driver: windows
        config:
          - subnet: 172.16.238.0/24
  
  </code></pre>