def run_via_api(self, container_params=None):
if not container_params:<EOL><INDENT>container_params = DockerContainerParameters()<EOL><DEDENT>host_config = self.d.create_host_config(auto_remove=container_params.remove,<EOL>cap_add=container_params.cap_add,<EOL>cap_drop=container_params.cap_drop,<EOL>devices=container_params.devices,<EOL>dns=container_params.dns,<EOL>group_add=container_params.group_add,<EOL>init=container_params.init,<EOL>ipc_mode=container_params.ipc_mode,<EOL>isolation=container_params.isolation,<EOL>mem_limit=container_params.mem_limit,<EOL>mounts=container_params.mounts,<EOL>pids_limit=container_params.pids_limit,<EOL>privileged=container_params.privileged,<EOL>publish_all_ports=container_params.publish_all_ports,<EOL>port_bindings=container_params.port_mappings,<EOL>read_only=container_params.read_only)<EOL>container = self.d.create_container(self.get_id(), command=container_params.command,<EOL>detach=True,<EOL>hostname=container_params.hostname,<EOL>user=container_params.user,<EOL>stdin_open=container_params.stdin_open,<EOL>tty=container_params.tty,<EOL>ports=container_params.exposed_ports,<EOL>environment=container_params.env_variables,<EOL>volumes=container_params.volumes,<EOL>name=container_params.name,<EOL>entrypoint=container_params.entrypoint,<EOL>working_dir=container_params.working_dir,<EOL>host_config=host_config,<EOL>mac_address=container_params.mac_address,<EOL>labels=container_params.labels,<EOL>stop_signal=container_params.stop_signal,<EOL>healthcheck=container_params.healthcheck,<EOL>runtime=container_params.runtime)<EOL>return DockerContainer(self, container['<STR_LIT>'], name=container_params.name)<EOL>
create a container using this image and run it in background via Docker-py API.
https://docker-py.readthedocs.io/en/stable/api.html
Note: If you are using Healthchecks, be aware that support of some options were introduced
just with version of Docker-py API 1.29
:param container_params: DockerContainerParameters
:return: instance of DockerContainer