Add a custom service

Use a custom service to create containers based on a Docker image. MedStack Control supports Docker Hub, private Docker registries, and any URL that hosts a Docker image. Docker Trusted Registry (DTR) is not currently supported.

  1. On the Configure page, click the cluster name.

  2. Click NEW SERVICE.

  3. Under New Custom Service, click Add New.

  4. Enter the following configuration settings, then click CREATE. Review the configuration, then click SAVE. The service is added to the cluster.


    Name 

    Enter a name for the service. This will be the domain name of the service on the Docker swarm overlay network. The name must contain characters that are valid in a domain name (lowercase, a-z, 0-9, no spaces, etc).

    Note: When you create a service, all tasks share the service name. For more information, see https://docs.docker.com/v17.12/docker-cloud/apps/service-links/. To understand how Docker swarm routes internal network traffic using the service name, see https://success.docker.com/article/networking#swarmnativeservicediscovery.

    Image
    Enter the Docker image name (with optional version tag). The format is hub.docker.com/your_registry_name/your_image_name:tag_name.

    If the image is a public image hosted on Docker Hub, no hostname is required and the version is optional (for example: postgres:11). If the image is hosted on another registry, include the URL as described in https://docs.docker.com/engine/reference/commandline/service_create/#create-a-service.

    If the registry is private and requires authentication, you must configure the registry first. For details, see Add a registry.

    Command
    If provided, this command will be executed by the container when it starts. This is equivalent to CMD in a Dockerfile ( https://docs.docker.com/engine/reference/builder/#cmd) or in a Docker compose file (https://docs.docker.com/compose/compose-file/#command).

    Args
    The arguments for the command, if one is provided.

    Hostname
    If you want the service to be accessible from the internet, see Hosts. If you want the service to be internally accessible from a hostname different from the service name, set the value here. For details, see https://docs.docker.com/engine/reference/commandline/service_create/#create-a-service-with-specific-hostname---hostname.

    Replicas
    The target number of containers to be run by the service. Service constraints will determine which nodes the containers run on.


    LOAD BALANCER

    If the service should be exposed to the public internet through a Load Balancer, enter the following configuration settings.

    Port
    Enter the port the container exposes (e.g. PORT in the Dockerfile). The Load Balancer will proxy from the public facing HTTPS port to this port on the container.

    Hosts
    A list of one or more domain names that are configured in DNS to point to the node IP. If you wish your domain example.com to be served by this container, create a DNS A record in your DNS provider (e.g. GoDaddy https://ca.godaddy.com/help/add-an-a-record-19238). Point the DNS record at the IP address of any of the nodes in your cluster, preferentially the manager node.


    ENVIRONMENT VARIABLES

    Environment variables are equivalent to the environment key in Docker Compose (for details, see https://docs.docker.com/compose/environment-variables/#set-environment-variables-in-containers). If you have many environment variables, you can use Secrets instead.

    1. Click ADD ENVIRONMENT VARIABLE. Enter the variable name and value.
    2. To remove a variable, click X.


    PLACEMENT CONSTRAINTS

    You can use placement constraints to control the placement of containers. For details, see https://docs.docker.com/engine/reference/commandline/service_create/#specify-service-constraints---constraint and https://success.docker.com/article/using-contraints-and-labels-to-control-the-placement-of-containers.

    1. Click ADD CONSTRAINT. Enter the constraint.
    2. To remove a constraint, click X.


    SECRETS

    Select the secrets you want to use with the service. The secret data will be mounted as a file inside the container. For details on creating secrets, see Manage secrets.

    1. Click ADD SECRET. Enter the name, filename, UID, GID, and Mode. For details, see https://docs.docker.com/engine/swarm/secrets/.
    2. To remove a secret, click X.


    MOUNTS

    You can use mounts to allow multiple containers on the same node to share the same data. Mounts can’t be used for containers on separate nodes. Using mounts is not generally recommended since containers may move from one node to another for a variety of reasons.

    1. Click ADD MOUNT. Enter the target and source. For details, see https://docs.docker.com/engine/swarm/services/#bind-mounts.
    2. To remove a mount, click X.


    CONFIGS

    Select the configs you want to use with the service. For details on creating configs, see Manage configs.

    1. Click ADD CONFIG. Enter the name, filename, UID, GID, and Mode. For details, see https://docs.docker.com/engine/swarm/configs/.
    2. To remove a config, click X.

Still need help? Contact Us Contact Us