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.
- On the Configure page, click the cluster name.
Click NEW SERVICE.
- Under New Custom Service, click Add New.
- Enter the following configuration settings, then click CREATE. Review the configuration, then click SAVE. The service is added to the cluster.
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.
Enter the Docker image name (with optional version tag). The format is
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.
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).
The arguments for the command, if one is provided.
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.
The target number of containers to be run by the service. Service constraints will determine which nodes the containers run on.
If the service should be exposed to the public internet through a Load Balancer, enter the following configuration settings.
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.
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 are equivalent to the
environmentkey 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.
- Click ADD ENVIRONMENT VARIABLE. Enter the variable name and value.
- To remove a variable, click X.
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.
- Click ADD CONSTRAINT. Enter the constraint.
- To remove a constraint, click X.
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.
- Click ADD SECRET. Enter the name, filename, UID, GID, and Mode. For details, see https://docs.docker.com/engine/swarm/secrets/.
- To remove a secret, click X.
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.
- Click ADD MOUNT. Enter the target and source. For details, see https://docs.docker.com/engine/swarm/services/#bind-mounts.
- To remove a mount, click X.
Select the configs you want to use with the service. For details on creating configs, see Manage configs.
- Click ADD CONFIG. Enter the name, filename, UID, GID, and Mode. For details, see https://docs.docker.com/engine/swarm/configs/.
- To remove a config, click X.