class_docstr: :class:`ContainerPod` starts a runtime of :class:`BaseRuntime` inside a container. It leverages :class:`multiprocessing.Process` to manage the logs and the lifecycle of docker container object in a robust way.
class_docstr_tok: [":","class",":","`","ContainerPod","`","starts","a","runtime","of",":","class",":","`","BaseRuntime","`","inside","a","container",".","It","leverages",":","class",":","`","multiprocessing.Process","`","to","manage","the","logs","and","the","lifecycle","of","docker","container","object","in","a","robust","way","."]
code: def _get_network_for_dind_linux(
      self, client: "DockerClient", ctrl_address: str
  ):
      import sys
      from platform import uname
  
      # Related to potential docker-in-docker communication. If `Runtime` lives already inside a container.
      # it will need to communicate using the `bridge` network.
      # In WSL, we need to set ports explicitly
      net_mode, runtime_ctrl_address = (
          getattr(
              self.args, "force_network_mode", DockerNetworkMode.AUTO
          ),
          ctrl_address,
      )
      if (
          sys.platform in ("linux", "linux2")
          and "microsoft" not in uname().release
      ):
          if net_mode == DockerNetworkMode.AUTO:
              net_mode = DockerNetworkMode.HOST
          if net_mode != DockerNetworkMode.NONE:
              try:
                  bridge_network = client.networks.get("bridge")
                  if bridge_network:
                      runtime_ctrl_address = f'{bridge_network.attrs["IPAM"]["Config"][0]["Gateway"]}:{self.args.port[0]}'
              except Exception as ex:
                  self.logger.warning(
                      f'Unable to set control address from "bridge" network: {ex!r}'
                      f" Control address set to {runtime_ctrl_address}"
                  )
  
      if net_mode in {DockerNetworkMode.AUTO, DockerNetworkMode.NONE}:
          net_mode = None
      else:
          net_mode = net_mode.to_string().lower()
  
      return net_mode, runtime_ctrl_address
  
imports: import argparse
  import copy
  import multiprocessing
  import os
  import platform
  import re
  import signal
  import time
  from typing import TYPE_CHECKING, Dict, Optional, Union
  from jina.constants import __docker_host__, __windows__
  from jina.enums import PodRoleType, DockerNetworkMode
  from jina.excepts import BadImageNameError, DockerVersionError
  from jina.helper import random_name, slugify
  from jina.importer import ImportExtensions
  from jina.logging.logger import JinaLogger
  from jina.orchestrate.helper import generate_default_volume_and_workspace
  from jina.orchestrate.pods import BasePod
  from jina.orchestrate.pods.container_helper import get_docker_network, get_gpu_device_requests
  from jina.parsers import set_gateway_parser
label_desc: Use image node_id 3 for calling the ContainerPod obj's underlying member method code with example usage: obj._get_network_for_dind_linux(client, ctrl_address) and returns: net_mode,  runtime_ctrl_address