Skip to content

Driver: Docker

Sergei Parshev edited this page Apr 16, 2023 · 10 revisions

Docker driver

Docker is relatively easy and quick way to run linux environments on any of your machines. It's better to use Linux hosts (as it meant to be), but could also work well with Mac and Win docker installations.

How it works?

How Docker driver works?

Docker could be both local or remote driver - but in both cases you will need docker utility to be installed and in remote config you will need to setup it properly to use the remote docker server.

Usage

To use the driver you need:

  • Install Docker
  • Create the image - Aquarium Bait will be the simplest way
  • Run the Aquarium Fish node, create Label and send Application to receive the resource you want

NOTE: The images are not pulled from dockerhub, aquarium-fish uses distillated tar archives of the docker images to preserve the images tree.

Configuration

Describes the driver options in the drivers section in the aquarium-fish config file:

drivers:
  - name: docker
    cfg:
      docker_path: string  # Absolute path to the `docker` executable binary, located automatically if it's in PATH

      is_remote: bool  # In case the docker client does not use the local node resources

      images_path:    string  # Abs/rel path to the directory where images will be downloaded and located, by default `$CWD/fish_docker_images`
      workspace_path: string  # Abs/rel path to the directory where the disks will be placed, by default `$CWD/fish_docker_workspace`

      # Alter allows you to control how much resources will be used:
      # * Negative (<0) value will alter the total resource count before provisioning so you will be
      #   able to save some resources for the host system (recommended -2 for CPU and -10 for RAM
      #   for disk caching)
      # * Positive (>0) value could also be available (but check it in your docker dist in advance)
      #   Please be careful here - noone wants the container to fail allocation because of that...
      cpu_alter: int  # 0 do nothing, <0 reduces number available CPUs, >0 increases it (dangerous)
      ram_alter: int  # 0 do nothing, <0 reduces amount of available RAM (GB), >0 increases it (dangerous)

      # Overbook options allows tenants to reuse the resources
      # It will be used only when overbook is allowed by the tenants. It works by just adding those
      # amounts to the existing total before checking availability. For example if you have 16CPU
      # and want to run 2 tenants with requirement of 14 CPUs each - you can put 12 in CpuOverbook -
      # to have virtually 28 CPUs. 3rd will not be running because 2 tenants will eat all 28 virtual
      # CPUs. Same applies to the RamOverbook.
      cpu_overbook: uint  # How much CPUs could be reused by multiple tenants
      ram_overbook: uint  # How much RAM (GB) could be reused by multiple tenants

      download_user:     string  # User used to download the images (from artifact storage), uses HTTP Basic Auth
      download_password: string  # Password for the user

Label definition

Describes the available options of the driver label definition:

definition:
  driver: docker

  options:
    image: string  # Name of the main image in the `images` list to run
    images: map    # Contains the locations of images to use
      <name>: <url>
      ...

  resources:
    node_filter: list  # List of the Fish Node identifiers, which allow to select the appropriate node for execution. Could use wildcards from path.Match
      - string
      - ...

    cpu:   uint  # Amount of CPUs (threads) required for the environment
    ram:   uint  # Amount of memory (in GB) required for the environment
    disks: map   # The disks to create/use in the VM
      <name>:          # The name of the disk file and label of the filesystem
        label: string  # Optional in case the label should be different from the disk name
        type:  string  # Filesystem type to format the new disk into, available: "dir", "hfs+", "exfat", "fat32"
        size:  uint    # The size of the disk (in GB), "dir" type will not restrict the amount of space for the resource
        reuse: bool    # Will mark this disk to stay after the resource is destroyed, WARN: can't be used by multiple containers for now

    # The modificators to simultaneous execution
    multitenancy: bool  # Tolerate to run along with the others
    cpu_overbook: bool  # Tolerate to CPU overbooking
    mem_overbook: bool  # Tolerate to RAM overbooking

    lifetime: duration  # Lifetime of the Resource in "1h2m3s" format. If "" or "0" - then default will be used, if negative - no timeout.

Examples:

Clone this wiki locally