{"id":2340,"date":"2017-01-06T06:09:59","date_gmt":"2017-01-06T06:09:59","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=2340"},"modified":"2023-06-21T06:18:51","modified_gmt":"2023-06-21T13:18:51","slug":"labels-constraints-docker-daemon-service","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/","title":{"rendered":"Labels and Constraints with Docker Daemon and Service"},"content":{"rendered":"<p><a href=\"https:\/\/docs.docker.com\/engine\/userguide\/labels-custom-metadata\/\">Metadata<\/a>, such as <a href=\"https:\/\/docs.docker.com\/engine\/userguide\/labels-custom-metadata\/#\/daemon-labels\">labels<\/a>, can be attached to a Docker daemon. A label is a key\/value pair and allows the Docker host to be a target of containers. The semantics of labels is completely defined by the application. A new Docker <a href=\"https:\/\/docs.docker.com\/swarm\/scheduler\/filter\/\">constraint<\/a> can be specified during service creation targeting the tasks on a particular host. Let&#8217;s see how we can use labels and constraints in Docker for a real-world application.<\/p>\n<p><a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/current\/architecture\/services-archi-multi-dimensional-scaling.html\">Couchbase using Multidimensional Scaling <\/a>(or MDS) allows us to split Index, Data, Query, and Full-text search service<br \/>\non multiple nodes. The needs for each service is different. For example, Query is CPU heavy, Index is disk intensive, and Data is a mix of memory and fast read\/write, such as SSD. MDS allows hardware resources to be independently assigned and optimized on a per node basis, as application requirements change.<br \/>\n<a href=\"\/wp-content\/original-assets\/july2015\/labels-and-constraints-with-docker-daemon-and-service\/couchbase-mds.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14140\" src=\"\/wp-content\/original-assets\/july2015\/labels-and-constraints-with-docker-daemon-and-service\/couchbase-mds.png\" alt=\"couchbase-mds\" width=\"975\" height=\"525\" \/><\/a> Read more about <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/current\/architecture\/services-archi-multi-dimensional-scaling.html\">Multidimensional Scaling<\/a>.<br \/>\nLet&#8217;s see how this can be easily accomplished in a three-node cluster using <a href=\"https:\/\/docs.docker.com\/engine\/swarm\/\">Docker\u00a0swarm mode<\/a>.<\/p>\n<h2>Start\u00a0Ubuntu Instances<\/h2>\n<p>Start\u00a0three\u00a0instances on EC2 of Ubuntu Server 14.04 LTS (HVM) (AMI ID:\u00a0<code>ami-06116566<\/code>).\u00a0Take\u00a0defaults in all cases except for the security group.\u00a0Swarm mode requires the following\u00a0three <a href=\"https:\/\/docs.docker.com\/engine\/swarm\/swarm-tutorial\/#\/open-ports-between-the-hosts\">ports open between hosts<\/a>:<\/p>\n<ul>\n<li><strong>TCP port 2377<\/strong> for cluster management communications<\/li>\n<li><strong>TCP<\/strong> and <strong>UDP port 7946<\/strong> for communication among nodes<\/li>\n<li><strong>TCP<\/strong> and <strong>UDP port 4789<\/strong> for overlay network traffic<\/li>\n<\/ul>\n<p>Make sure to create a new security group with these rules:<br \/>\n<a href=\"\/wp-content\/original-assets\/july2015\/labels-and-constraints-with-docker-daemon-and-service\/ec2-swarmmode-security-group-1024x652.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-14144\" src=\"\/wp-content\/original-assets\/july2015\/labels-and-constraints-with-docker-daemon-and-service\/ec2-swarmmode-security-group-1024x652.png\" alt=\"ec2-swarmmode-security-group\" width=\"604\" height=\"385\" \/><\/a><br \/>\nWait for a few minutes for the instances to be provisioned.<\/p>\n<h2>Set Up Docker on Ubuntu<\/h2>\n<p>Swarm mode is introduced in Docker 1.12. At the time of this writing, 1.12 RC4 is the latest candidate. Use the following script to install\u00a0the\u00a0RC4 release with experimental features:<\/p>\n<pre class=\"lang:default decode:true\">publicIp=`aws ec2 describe-instances --filters Name=instance-state-name,Values=running | jq -r .Reservations[].Instances[].PublicDnsName`\r\nfor node in $publicIp\r\ndo\r\n    ssh -o StrictHostKeyChecking=no -i ~\/.ssh\/aruncouchbase.pem ubuntu@$node 'curl -fsSL https:\/\/experimental.docker.com\/ | sh'\r\n    ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@$node 'sudo usermod -aG docker ubuntu'\r\n    ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@$node 'docker version'\r\ndone<\/pre>\n<p>This script assumes that <a href=\"https:\/\/docs.aws.amazon.com\/cli\/latest\/userguide\/cli-chap-getting-set-up.html\">AWS CLI is already setup<\/a>\u00a0and performs the following configuration for <strong>all<\/strong> running instances in your configured EC2<br \/>\naccount:<\/p>\n<ul>\n<li>Get public IP address of each instance<\/li>\n<li>For each instance\n<ul>\n<li>Install latest Docker release with experimental features<\/li>\n<li>Adds <code>ubuntu<\/code> user to the <code>docker<\/code> group. This allows Docker to be used as a non-root user.<\/li>\n<li>Prints the Docker version<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>This simple script will setup Docker host on all three instances.<\/p>\n<h2>Assign Labels to Docker Daemon<\/h2>\n<p>Labels\u00a0can be defined\u00a0using <code>DOCKER_OPTS<\/code>. For Ubuntu, this is defined in the\u00a0<code>\/etc\/default\/docker<\/code>\u00a0file. Distinct labels need to be assigned to each node. For example, use\u00a0<code>couchbase.mds<\/code>\u00a0key<br \/>\nand<br \/>\n<code>index<\/code> value.<\/p>\n<pre class=\"lang:default decode:true\">ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ \r\n'sudo sed -i '\/#DOCKER_OPTS\/cDOCKER_OPTS=\"--label=couchbase.mds=index\"' \/etc\/default\/docker';\r\nssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ 'sudo restart docker'\r\nssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ 'docker info';\r\n<\/pre>\n<p>You also need to restart Docker daemon. Finally, <code>docker info<\/code>\u00a0displays system-wide information:<\/p>\n<pre class=\"lang:default decode:true\">Containers: 0\r\n Running: 0\r\n Paused: 0\r\n Stopped: 0\r\nImages: 0\r\nServer Version: 1.12.0-rc4\r\nStorage Driver: aufs\r\n Root Dir: \/var\/lib\/docker\/aufs\r\n Backing Filesystem: extfs\r\n Dirs: 0\r\n Dirperm1 Supported: false\r\nLogging Driver: json-file\r\nCgroup Driver: cgroupfs\r\nPlugins:\r\n Volume: local\r\n Network: null host bridge overlay\r\nSwarm: inactive\r\nRuntimes: runc\r\nDefault Runtime: runc\r\nSecurity Options: apparmor\r\nKernel Version: 3.13.0-74-generic\r\nOperating System: Ubuntu 14.04.3 LTS\r\nOSType: linux\r\nArchitecture: x86_64\r\nCPUs: 1\r\nTotal Memory: 992.5 MiB\r\nName: ip-172-31-14-15\r\nID: KISZ:RSMD:4YOZ:2FKL:GJTN:EVGC:U3GH:CHC3:XUJN:4UJ2:H3QF:GZFH\r\nDocker Root Dir: \/var\/lib\/docker\r\nDebug Mode (client): false\r\nDebug Mode (server): false\r\nRegistry: https:\/\/index.docker.io\/v1\/\r\nLabels:\r\n couchbase.mds=index\r\nExperimental: true\r\nInsecure Registries:\r\n 127.0.0.0\/8\r\nWARNING: No swap limit support<\/pre>\n<p>As you can see, labels are\u00a0visible in this information. For the second node, assign a different label:<\/p>\n<pre class=\"lang:default decode:true\">ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ \r\n'sudo sed -i '\/#DOCKER_OPTS\/cDOCKER_OPTS=\"--label=couchbase.mds=data\"' \/etc\/default\/docker';\r\nssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ 'sudo restart docker'\r\nssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ 'docker info';<\/pre>\n<p>Make sure to use the IP address of the second EC2 instance. The updated information about the Docker daemon in this case will be:<\/p>\n<pre class=\"lang:default decode:true\">Labels:\r\n couchbase.mds=data<\/pre>\n<p>And finally, the last node:<\/p>\n<pre class=\"lang:default decode:true\">ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ \r\n'sudo sed -i '\/#DOCKER_OPTS\/cDOCKER_OPTS=\"--label=couchbase.mds=query\"' \/etc\/default\/docker';\r\nssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ 'sudo restart docker'\r\nssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ 'docker info';<\/pre>\n<p>The updated information about the Docker daemon for this host will show:<\/p>\n<pre class=\"lang:default decode:true\">Labels:\r\n couchbase.mds=query<\/pre>\n<p>In our case, a homogenous cluster is created where machines are exactly alike, including their operating system, CPU, disk and memory capacity. In the real world, you&#8217;ll typically have the same operating system but the instance capacity, such as disk, CPU and memory, would differ based upon what Couchbase services you want to run on them. These labels would\u00a0make perfect\u00a0sense in that case but they do show the point here.<\/p>\n<h2>Enable Swarm Mode and Create Cluster<\/h2>\n<p>Let&#8217;s enable Swarm Mode and create a cluster of 1 Manager and 2 Worker nodes. By default, managers are worker nodes as well. Initialize Swarm on the first node:<\/p>\n<pre class=\"lang:default decode:true\">ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ 'docker swarm init --secret mySecret --listen-addr :2377'<\/pre>\n<p>This will show the output:<\/p>\n<pre class=\"lang:default decode:true\">Swarm initialized: current node (ezrf5ap238kpmyq5h0lf55hxi) is now a manager.\r\n\r\nTo add a worker to this swarm, run the following command:\r\n docker swarm join --secret mySecret \r\n --ca-hash sha256:ebda297c36a9d4c772f9e7867c453da42f69fe37cdfb1ba087f073051593a683 \r\n ip-172-31-14-15.us-west-1.compute.internal:2377<\/pre>\n<p>Add other two nodes as worker:<\/p>\n<pre class=\"lang:default decode:true\">ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ 'docker swarm join --secret mySecret :2377'\r\nssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ 'docker swarm join --secret mySecret :2377'<\/pre>\n<p>The exact commands, and output, in this case are:<\/p>\n<pre class=\"lang:default decode:true\">ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ec2-54-153-101-215.us-west-1.compute.amazonaws.com 'docker swarm init --secret mySecret --listen-addr ip-172-31-14-15.us-west-1.compute.internal:2377'\r\nssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ec2-52-53-223-255.us-west-1.compute.amazonaws.com 'docker swarm join --secret mySecret ip-172-31-14-15.us-west-1.compute.internal:2377'\r\nssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ec2-52-53-251-64.us-west-1.compute.amazonaws.com 'docker swarm join --secret mySecret ip-172-31-14-15.us-west-1.compute.internal:2377'<\/pre>\n<p>Complete details about the cluster can now be obtained:<\/p>\n<pre class=\"lang:default decode:true\">ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ec2-54-153-101-215.us-west-1.compute.amazonaws.com 'docker info'<\/pre>\n<p>And this shows the output:<\/p>\n<pre class=\"lang:default decode:true\">Containers: 0\r\n Running: 0\r\n Paused: 0\r\n Stopped: 0\r\nImages: 0\r\nServer Version: 1.12.0-rc4\r\nStorage Driver: aufs\r\n Root Dir: \/var\/lib\/docker\/aufs\r\n Backing Filesystem: extfs\r\n Dirs: 0\r\n Dirperm1 Supported: false\r\nLogging Driver: json-file\r\nCgroup Driver: cgroupfs\r\nPlugins:\r\n Volume: local\r\n Network: bridge null host overlay\r\nSwarm: active\r\n NodeID: ezrf5ap238kpmyq5h0lf55hxi\r\n IsManager: Yes\r\n Managers: 1\r\n Nodes: 3\r\n CACertHash: sha256:ebda297c36a9d4c772f9e7867c453da42f69fe37cdfb1ba087f073051593a683\r\nRuntimes: runc\r\nDefault Runtime: runc\r\nSecurity Options: apparmor\r\nKernel Version: 3.13.0-74-generic\r\nOperating System: Ubuntu 14.04.3 LTS\r\nOSType: linux\r\nArchitecture: x86_64\r\nCPUs: 1\r\nTotal Memory: 992.5 MiB\r\nName: ip-172-31-14-15\r\nID: KISZ:RSMD:4YOZ:2FKL:GJTN:EVGC:U3GH:CHC3:XUJN:4UJ2:H3QF:GZFH\r\nDocker Root Dir: \/var\/lib\/docker\r\nDebug Mode (client): false\r\nDebug Mode (server): false\r\nRegistry: https:\/\/index.docker.io\/v1\/\r\nLabels:\r\n couchbase.mds=index\r\nExperimental: true\r\nInsecure Registries:\r\n 127.0.0.0\/8\r\nWARNING: No swap limit support<\/pre>\n<p>This shows that we&#8217;ve created a 3-node cluster with one manager.<\/p>\n<h2>Run Docker\u00a0Service\u00a0with Constraints<\/h2>\n<p>Now, we are going to run three Couchbase services with different constraints. Each Docker service specifies constraints using<code>--constraint engine.labels.<label><\/label><\/code> format where there are matches the labels defined earlier for the nodes. Each service is given a unique name as it allows to scale them individually. All commands are directed towards the Swarm manager:<\/p>\n<pre class=\"lang:default decode:true\">ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ 'docker service create --name=cb-mds-index --constraint engine.labels.couchbase.mds==index couchbase'\r\nssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ 'docker service create --name=cb-mds-data --constraint engine.labels.couchbase.mds==data couchbase'\r\nssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ 'docker service create --name=cb-mds-query --constraint engine.labels.couchbase.mds==query couchbase'<\/pre>\n<p>The exact commands in our case are:<\/p>\n<pre class=\"lang:default decode:true\">&gt; ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ec2-54-153-101-215.us-west-1.compute.amazonaws.com 'docker service create --name=cb-mds-index --constraint engine.labels.couchbase.mds==index couchbase'\r\n34lcko519mvr32hxw2m8dwp5c\r\n&gt; ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ec2-54-153-101-215.us-west-1.compute.amazonaws.com 'docker service create --name=cb-mds-data --constraint engine.labels.couchbase.mds==data couchbase'\r\n0drcucii08tnx5sm9prug30m1\r\n&gt; ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ec2-54-153-101-215.us-west-1.compute.amazonaws.com 'docker service create --name=cb-mds-query --constraint engine.labels.couchbase.mds==query couchbase'<\/pre>\n<p>The list of services can be verified as:<\/p>\n<pre class=\"lang:default decode:true\">ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ 'docker service ls'<\/pre>\n<p>This shows the output as:<\/p>\n<pre class=\"lang:default decode:true\">ID            NAME          REPLICAS  IMAGE      COMMAND\r\n0drcucii08tn  cb-mds-data   1\/1       couchbase  \r\n34lcko519mvr  cb-mds-index  1\/1       couchbase  \r\nbxjqjm6mashw  cb-mds-query  1\/1       couchbase<\/pre>\n<p>And the list of\u00a0tasks (essentially containers within that service) for each service can then be verified as:<\/p>\n<pre class=\"lang:default decode:true\">&gt; ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ 'docker service tasks '<\/pre>\n<p>And the output in our case:<\/p>\n<pre class=\"lang:default decode:true\">&gt; ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ec2-54-153-101-215.us-west-1.compute.amazonaws.com 'docker service tasks cb-mds-index'\r\nID                         NAME            SERVICE       IMAGE      LAST STATE             DESIRED STATE  NODE\r\n58jxojx32nf66jwqwt7nyg3cf  cb-mds-index.1  cb-mds-index  couchbase  Running 6 minutes ago  Running        ip-172-31-14-15\r\n&gt; ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ec2-54-153-101-215.us-west-1.compute.amazonaws.com 'docker service tasks cb-mds-data'\r\nID                         NAME           SERVICE      IMAGE      LAST STATE             DESIRED STATE  NODE\r\naf9zpuh6956fcih0sr70hfban  cb-mds-data.1  cb-mds-data  couchbase  Running 6 minutes ago  Running        ip-172-31-14-14\r\n&gt; ssh -i ~\/.ssh\/aruncouchbase.pem ubuntu@ec2-54-153-101-215.us-west-1.compute.amazonaws.com 'docker service tasks cb-mds-query'\r\nID                         NAME            SERVICE       IMAGE      LAST STATE             DESIRED STATE  NODE\r\nceqaza4xk02ha7t1un60jxtem  cb-mds-query.1  cb-mds-query  couchbase  Running 6 minutes ago  Running        ip-172-31-14-13<\/pre>\n<p>This shows the services are nicely distributed across different nodes. Feel free to check out if the task is indeed scheduled on the node with the right label. All Couchbase instances can be configured in a cluster to provide a complete database solution for your web, mobile, and IoT applications. Want to learn more?<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.docker.com\/engine\/swarm\/\">Docker Swarm Mode<\/a><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/containers\/\">Couchbase on Containers<\/a><\/li>\n<li>Follow us on <a href=\"https:\/\/twitter.com\/couchbasedev\">@couchbasedev<\/a> or <a href=\"https:\/\/twitter.com\/couchbase\">@couchbase<\/a><\/li>\n<li>Ask questions on <a href=\"https:\/\/www.couchbase.com\/forums\/\">Couchbase Forums<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Metadata, such as labels, can be attached to a Docker daemon. A label is a key\/value pair and allows the Docker host to be a target of containers. The semantics of labels is completely defined by the application. A new [&hellip;]<\/p>\n","protected":false},"author":58,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1816],"tags":[],"ppma_author":[8933],"class_list":["post-2340","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-couchbase-server"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.8 (Yoast SEO v25.8) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Docker Daemon and Service: Labels + Constraints | Couchbase<\/title>\n<meta name=\"description\" content=\"Metadata, such as labels, can be attached to a Docker daemon. Learn how to use labels and constraints in Docker for a real-world application.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Labels and Constraints with Docker Daemon and Service\" \/>\n<meta property=\"og:description\" content=\"Metadata, such as labels, can be attached to a Docker daemon. Learn how to use labels and constraints in Docker for a real-world application.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-06T06:09:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-21T13:18:51+00:00\" \/>\n<meta name=\"author\" content=\"Arun Gupta, VP, Developer Advocacy, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@arungupta\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Arun Gupta, VP, Developer Advocacy, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/\"},\"author\":{\"name\":\"Arun Gupta, VP, Developer Advocacy, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/39d8caed0f536489b6aa6e8d31ee631f\"},\"headline\":\"Labels and Constraints with Docker Daemon and Service\",\"datePublished\":\"2017-01-06T06:09:59+00:00\",\"dateModified\":\"2023-06-21T13:18:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/\"},\"wordCount\":783,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"articleSection\":[\"Couchbase Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/\",\"name\":\"Docker Daemon and Service: Labels + Constraints | Couchbase\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2017-01-06T06:09:59+00:00\",\"dateModified\":\"2023-06-21T13:18:51+00:00\",\"description\":\"Metadata, such as labels, can be attached to a Docker daemon. Learn how to use labels and constraints in Docker for a real-world application.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Labels and Constraints with Docker Daemon and Service\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/39d8caed0f536489b6aa6e8d31ee631f\",\"name\":\"Arun Gupta, VP, Developer Advocacy, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/8900a75409c646948fe0bd80f6240337\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f912e10b5f39748ee4f1a0b0da6f42747f0b3a94fe7acb511791468656f5e726?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f912e10b5f39748ee4f1a0b0da6f42747f0b3a94fe7acb511791468656f5e726?s=96&d=mm&r=g\",\"caption\":\"Arun Gupta, VP, Developer Advocacy, Couchbase\"},\"description\":\"Arun Gupta is the vice president of developer advocacy at Couchbase. He has built and led developer communities for 10+ years at Sun, Oracle, and Red Hat. He has deep expertise in leading cross-functional teams to develop and execute strategy, planning and execution of content, marketing campaigns, and programs. Prior to that he led engineering teams at Sun and is a founding member of the Java EE team. Gupta has authored more than 2,000 blog posts on technology. He has extensive speaking experience in more than 40 countries on myriad topics and is a JavaOne Rock Star for three years in a row. Gupta also founded the Devoxx4Kids chapter in the US and continues to promote technology education among children. An author of several books on technology, an avid runner, a globe trotter, a Java Champion, a JUG leader, NetBeans Dream Team member, and a Docker Captain, he is easily accessible at @arungupta.\",\"sameAs\":[\"https:\/\/x.com\/arungupta\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/arun-gupta\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Docker Daemon and Service: Labels + Constraints | Couchbase","description":"Metadata, such as labels, can be attached to a Docker daemon. Learn how to use labels and constraints in Docker for a real-world application.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/","og_locale":"en_US","og_type":"article","og_title":"Labels and Constraints with Docker Daemon and Service","og_description":"Metadata, such as labels, can be attached to a Docker daemon. Learn how to use labels and constraints in Docker for a real-world application.","og_url":"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/","og_site_name":"The Couchbase Blog","article_published_time":"2017-01-06T06:09:59+00:00","article_modified_time":"2023-06-21T13:18:51+00:00","author":"Arun Gupta, VP, Developer Advocacy, Couchbase","twitter_card":"summary_large_image","twitter_creator":"@arungupta","twitter_misc":{"Written by":"Arun Gupta, VP, Developer Advocacy, Couchbase","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/"},"author":{"name":"Arun Gupta, VP, Developer Advocacy, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/39d8caed0f536489b6aa6e8d31ee631f"},"headline":"Labels and Constraints with Docker Daemon and Service","datePublished":"2017-01-06T06:09:59+00:00","dateModified":"2023-06-21T13:18:51+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/"},"wordCount":783,"commentCount":1,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","articleSection":["Couchbase Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/","url":"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/","name":"Docker Daemon and Service: Labels + Constraints | Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2017-01-06T06:09:59+00:00","dateModified":"2023-06-21T13:18:51+00:00","description":"Metadata, such as labels, can be attached to a Docker daemon. Learn how to use labels and constraints in Docker for a real-world application.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/labels-constraints-docker-daemon-service\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Labels and Constraints with Docker Daemon and Service"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/39d8caed0f536489b6aa6e8d31ee631f","name":"Arun Gupta, VP, Developer Advocacy, Couchbase","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/8900a75409c646948fe0bd80f6240337","url":"https:\/\/secure.gravatar.com\/avatar\/f912e10b5f39748ee4f1a0b0da6f42747f0b3a94fe7acb511791468656f5e726?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f912e10b5f39748ee4f1a0b0da6f42747f0b3a94fe7acb511791468656f5e726?s=96&d=mm&r=g","caption":"Arun Gupta, VP, Developer Advocacy, Couchbase"},"description":"Arun Gupta is the vice president of developer advocacy at Couchbase. He has built and led developer communities for 10+ years at Sun, Oracle, and Red Hat. He has deep expertise in leading cross-functional teams to develop and execute strategy, planning and execution of content, marketing campaigns, and programs. Prior to that he led engineering teams at Sun and is a founding member of the Java EE team. Gupta has authored more than 2,000 blog posts on technology. He has extensive speaking experience in more than 40 countries on myriad topics and is a JavaOne Rock Star for three years in a row. Gupta also founded the Devoxx4Kids chapter in the US and continues to promote technology education among children. An author of several books on technology, an avid runner, a globe trotter, a Java Champion, a JUG leader, NetBeans Dream Team member, and a Docker Captain, he is easily accessible at @arungupta.","sameAs":["https:\/\/x.com\/arungupta"],"url":"https:\/\/www.couchbase.com\/blog\/author\/arun-gupta\/"}]}},"authors":[{"term_id":8933,"user_id":58,"is_guest":0,"slug":"arun-gupta","display_name":"Arun Gupta, VP, Developer Advocacy, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/f912e10b5f39748ee4f1a0b0da6f42747f0b3a94fe7acb511791468656f5e726?s=96&d=mm&r=g","author_category":"","last_name":"Gupta","first_name":"Arun","job_title":"","user_url":"","description":"Arun Gupta is the vice president of developer advocacy at Couchbase. He has built and led developer communities for 10+ years at Sun, Oracle, and Red Hat. He has deep expertise in leading cross-functional teams to develop and execute strategy, planning and execution of content, marketing campaigns, and programs. Prior to that he led engineering teams at Sun and is a founding member of the Java EE team.\r\n\r\nGupta has authored more than 2,000 blog posts on technology. He has extensive speaking experience in more than 40 countries on myriad topics and is a JavaOne Rock Star for three years in a row. Gupta also founded the Devoxx4Kids chapter in the US and continues to promote technology education among children. An author of several books on technology, an avid runner, a globe trotter, a Java Champion, a JUG leader, NetBeans Dream Team member, and a Docker Captain, he is easily accessible at @arungupta."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/58"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=2340"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2340\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=2340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=2340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=2340"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=2340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}