MCPcopy
hub / github.com/docker/docker-py / create_host_config

Method create_host_config

docker/api/container.py:459–617  ·  view source on GitHub ↗

Create a dictionary for the ``host_config`` argument to :py:meth:`create_container`. Args: auto_remove (bool): enable auto-removal of the container on daemon side when the container's process exits. binds (dict): Volumes to bind. See

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

457 return self._result(res, True)
458
459 def create_host_config(self, *args, **kwargs):
460 """
461 Create a dictionary for the ``host_config`` argument to
462 :py:meth:`create_container`.
463
464 Args:
465 auto_remove (bool): enable auto-removal of the container on daemon
466 side when the container's process exits.
467 binds (dict): Volumes to bind. See :py:meth:`create_container`
468 for more information.
469 blkio_weight_device: Block IO weight (relative device weight) in
470 the form of: ``[{"Path": "device_path", "Weight": weight}]``.
471 blkio_weight: Block IO weight (relative weight), accepts a weight
472 value between 10 and 1000.
473 cap_add (list of str): Add kernel capabilities. For example,
474 ``["SYS_ADMIN", "MKNOD"]``.
475 cap_drop (list of str): Drop kernel capabilities.
476 cpu_period (int): The length of a CPU period in microseconds.
477 cpu_quota (int): Microseconds of CPU time that the container can
478 get in a CPU period.
479 cpu_shares (int): CPU shares (relative weight).
480 cpuset_cpus (str): CPUs in which to allow execution (``0-3``,
481 ``0,1``).
482 cpuset_mems (str): Memory nodes (MEMs) in which to allow execution
483 (``0-3``, ``0,1``). Only effective on NUMA systems.
484 device_cgroup_rules (:py:class:`list`): A list of cgroup rules to
485 apply to the container.
486 device_read_bps: Limit read rate (bytes per second) from a device
487 in the form of: `[{"Path": "device_path", "Rate": rate}]`
488 device_read_iops: Limit read rate (IO per second) from a device.
489 device_write_bps: Limit write rate (bytes per second) from a
490 device.
491 device_write_iops: Limit write rate (IO per second) from a device.
492 devices (:py:class:`list`): Expose host devices to the container,
493 as a list of strings in the form
494 ``<path_on_host>:<path_in_container>:<cgroup_permissions>``.
495
496 For example, ``/dev/sda:/dev/xvda:rwm`` allows the container
497 to have read-write access to the host&#x27;s ``/dev/sda`` via a
498 node named ``/dev/xvda`` inside the container.
499 device_requests (:py:class:`list`): Expose host resources such as
500 GPUs to the container, as a list of
501 :py:class:`docker.types.DeviceRequest` instances.
502 dns (:py:class:`list`): Set custom DNS servers.
503 dns_opt (:py:class:`list`): Additional options to be added to the
504 container&#x27;s ``resolv.conf`` file
505 dns_search (:py:class:`list`): DNS search domains.
506 extra_hosts (dict): Additional hostnames to resolve inside the
507 container, as a mapping of hostname to IP address.
508 group_add (:py:class:`list`): List of additional group names and/or
509 IDs that the container process will run as.
510 init (bool): Run an init inside the container that forwards
511 signals and reaps processes
512 ipc_mode (str): Set the IPC mode for the container.
513 isolation (str): Isolation technology to use. Default: ``None``.
514 links (dict): Mapping of links using the
515 ``{'container': 'alias'}`` format. The alias is optional.
516 Containers declared in this dict will be linked to the new

Calls 1

HostConfigClass · 0.85