CINXE.COM
Install Couchbase Server Using Docker | Couchbase Docs
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv=content-security-policy content="default-src 'none'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https:; style-src 'self' 'unsafe-inline' https:; font-src 'self' https://fonts.gstatic.com; frame-src 'self' https:; img-src 'self' data: https:; connect-src 'self' https:; worker-src blob:;"> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <title>Install Couchbase Server Using Docker | Couchbase Docs</title> <link rel="canonical" href="https://docs.couchbase.com/server/current/install/getting-started-docker.html"> <link rel="stylesheet" href="../../../_/css/site.css"> <script src="../../../_/js/vendor/jquery.js"></script> <script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" data-domain-script="748511ff-10bf-44bf-88b8-36382e5b5fd9"></script> <script>function OptanonWrapper(){}</script> <meta name="description" content="Couchbase Server can be installed using official Couchbase images from Docker Hub."> <link rel="schema.dcterms" href="https://purl.org/dc/terms/"> <meta name="dcterms.subject" content="server"> <meta name="dcterms.identifier" content="7.6"> <meta name="page-url" content="/server/current/install/getting-started-docker.html"> <meta name="page-nav-header-levels" content="0"> <meta name="docsearch:component" content="server"> <meta name="docsearch:component_title" content="Couchbase Server"> <meta name="docsearch:cversion" content="7.6"> <meta name="docsearch:component_version" content="server@7.6"> <meta name="docsearch:module" content="install"> <meta name="docsearch:breadcrumbs" content="Couchbase Server / Install & Upgrade / Cloud and Container Deployment / Docker / Install with Docker"> <meta name="docsearch:topic_type" content=""> <meta name="docsearch:version_rank" content="1"> <meta name="docsearch:status" content=""> <meta name="docsearch:edition" content=""> <meta name="docsearch:page_rank" content="50"> <meta name="generator" content="Antora 3.1.10"> <link rel="icon" href="../../../_/img/favicon.svg" type="image/svg+xml"> <link rel="icon" href="../../../_/img/favicon.ico" type="image/x-icon" sizes="any"> </head> <body class="article"> <header class="header fixed-top"> <div class="header-top-row"> <div class="container"> <nav class="navbar navbar-expand-md flex-nowrap justify-content-between navbar-new-top"> <ul class="navbar-brand-list"> <li class="brand-logo"> <a class="navbar-brand" href="https://www.couchbase.com"> <img src="../../../_/img/couchbase-logo.svg" alt="Couchbase" /> </a> </li> <li> <a class="navbar-brand cb-documentation" href="https://docs.couchbase.com/home/index.html"> <img src="../../../_/img/cb-documentation.svg" alt="Couchbase Documentation" class="cb-docs" /> <img src="../../../_/img/cb-docs-hover.svg" alt="Couchbase Documentation" class="hide cb-hover-docs" /> </a> </li> </ul> <button class="navbar-burger" data-target="topbar-menu"> <span></span> <span></span> <span></span> </button> </nav> </div> </div> <div class="header-bottom-row" id="topbar-menu"> <div class="container"> <nav class="navbar navbar-new-bottom "> <div class="navbar-collapse collapse" id="navbar2"> <ul class="navbar-nav w-100 justify-content-start"> <li class="nav-item ""> <a href="https://docs.couchbase.com/home/index.html" class="nav-link"> <i class="fas fa-home"></i> </a> </li> <li class="nav-item nav-item-selected"> <a class="nav-link" href="../../../home/server.html"> Server </a> </li> <li class="nav-item "> <a class="nav-link" href="../../../home/mobile.html"> Mobile </a> </li> <li class="nav-item "> <a class="nav-link" href="../../../home/cloud.html"> Capella </a> </li> <li class="nav-item "> <a class="nav-link" href="../../../cloud-native-database/index.html"> Cloud-Native </a> </li> <li class="nav-item "> <a class="nav-link" href="../../../home/sdk.html"> Couchbase SDKs </a> </li> <li class="nav-item "> <a class="nav-link" href="../../../home/columnar-sdk.html"> Columnar SDKs </a> </li> </ul> </div> <div class="primary-action"> <div class="navbar-item search" id="search"> <input class="dataLayer query" type="text" placeholder="Search Docs"><i class="fas fa-search"></i> </div> <a class="btn btn-primary btn-grey-reverse" onclick="(window.dataLayer=window.dataLayer||[]).push({'event':'customEvent', 'category':'CTA', 'action':'Button Click', 'label':'Download'});" href="https://www.couchbase.com/downloads"> Downloads <i class="far fa-arrow-to-bottom fa-fw"></i> </a> <a href="https://cloud.couchbase.com/sign-up" class="btn btn-primary" onclick="(window.dataLayer=window.dataLayer||[]).push({'event':'customEvent', 'category':'CTA', 'action':'Button Click', 'label':'Free Trial'});" > Try Free <i class="far fa-cloud fa-fw"></i> </a> </div> </nav> </div> </div> </header> <div class="body container"> <aside class="nav left-sidebar"> <div class="nav-container"> <a href="#" class="menu-expand-toggle"><span>Navigation</span><i class="fas fa-times-circle"></i><i class="fas fa-chevron-circle-left"></i></a> <template id="page-versions" style="display: none"> <select class="version_list" data-component="server"> <option value="7.6" data-url="getting-started-docker.html" selected>7.6</option> <option value="7.2" data-url="../../7.2/install/getting-started-docker.html">7.2</option> <option value="7.1" data-url="../../7.1/install/getting-started-docker.html">7.1</option> <option value="7.0" data-url="../../7.0/install/getting-started-docker.html">7.0</option> </select> </template> </div> </aside> <aside class="toc sidebar" data-title="Contents" data-levels="1"> <div class="sidebar-box"> <div class="tools" role="navigation"> <ul> <li class="tool edit"><a href="https://github.com/couchbase/docs-server/edit/release/7.6/modules/install/pages/getting-started-docker.adoc" title="Edit Page" target="_blank" rel="noopener" class="remove-ext-icon">Edit on GitHub</a></li> </ul> </div> <div class="toc-menu"></div> <div class="is-this-helpful-box"> <h4> Is this page helpful?</h4> <div class="btn-row"> <a href="#" class="like-btn helpful-btn" id="yesBtn" data-page-rating="like" > <i class="far fa-thumbs-up"></i> Yes </a> <a href="#" class="dislike-btn helpful-btn" id="noBtn" data-page-rating="dislike"> <i class="far fa-thumbs-down"></i> No</a> </div> <div class="any-feedback"> <a href="#" class="btn any-feedback-btn" id="myCustomTrigger">Leave Additional Feedback? </a> </div> <div class="dialog-box" id="dialogBox"> <form> <div class="form-group " id="additionalFeedbackBox"> <textarea class="input-control feed-back-msg" rows="8" placeholder="Any Additonal Feedback?"></textarea> <div class="action-btn-row "> <a href="#" class="skip-btn" id="skipBtnMsg">Skip</a> <button class="submit-btn btn blue-btn disabled" > Submit </button> <a href="#" class="info-btn"><i class="fas fa-info-circle"></i></a> </div> </div> </form> </div> </div> </div> </aside> <div class="feedback-modal modal-popup"> <div class="modal-popup-dialogue"> <div class="popup-header"> <a href="#" class="close-popup"><i class="fa fa-times"></i></a> </div> <div class="popup-content"> <p> Please use the form below to provide your feedback. Because your feedback is valuable to us, the information you submit in this form is recorded in our issue tracking system (JIRA), which is publicly available. You can track the status of your feedback using the ticket number displayed in the dialog once you submit the form. </p> </div> </div> </div> <main class="article" data-ceiling="topbar"> <div class="article-header"> <nav class="crumbs" aria-label="breadcrumbs"> <ul> <li class="crumb"><a href="../introduction/intro.html">Couchbase Server</a></li> <li class="crumb">Install & Upgrade</li> <li class="crumb"><a href="../cloud/couchbase-cloud-deployment.html">Cloud and Container Deployment</a></li> <li class="crumb">Docker</li> <li class="crumb"><a href="getting-started-docker.html">Install with Docker</a></li> </ul> </nav> </div> <article class="doc"> <div class="page-heading-title"> <h1 class="page">Install Couchbase Server Using Docker</h1> <div class="labels"> <ul></ul> </div> </div> <div class="contributor-list-box"> <span class="last-commit-date" id="commitdate"> </span> <ul id="contributorList"></ul> <span id="otherContributor"> + </span> </div><div id="preamble"> <div class="sectionbody"> <div class="quoteblock abstract"> <blockquote> Couchbase Server can be installed using official Couchbase images from Docker Hub. </blockquote> </div> <div class="paragraph"> <p>If you’re trying Couchbase Server for the first time and just want to explore a Couchbase configuration, the quickest way to install a pre-configured single-node deployment using Docker is to follow the <a href="../getting-started/start-here.html" class="xref page">Get Started</a> tutorial.</p> </div> <div class="paragraph"> <p>For more traditional Docker deployments, use the following sections below:</p> </div> <div class="ulist"> <ul> <li> <p><a href="#section_jvt_zvj_42b">Deploy a Single-Node Cluster with Containers</a></p> </li> <li> <p><a href="#section_msh_fbl_42b">Deploy a Multi-Node Cluster with Containers</a></p> </li> <li> <p><a href="#section_deploy_multiple_clusters">Deploy Multiple Clusters with Containers</a></p> </li> </ul> </div> <div class="paragraph"> <p>If you’re simply looking for the official Couchbase Server Docker image, you can find it on <a href="https://hub.docker.com/_/couchbase/" target="_blank" rel="noopener">Docker Hub</a>.</p> </div> </div> </div> <div class="sect1"> <h2 id="section_jvt_zvj_42b"><a class="anchor" href="#section_jvt_zvj_42b"></a>Deploy a Single-Node Cluster with Containers</h2> <div class="sectionbody"> <div class="paragraph"> <p>To run a single-node cluster, you will need to deploy a single container representing the single Couchbase Server node.</p> </div> <div class="admonitionblock note"> <table> <tr> <td class="icon"> <i class="fa icon-note" title="Note"></i> </td> <td class="content"> <div class="paragraph"> <p>For detailed information about deploying Couchbase Server, make sure to review the Couchbase Server <a href="plan-for-production.html" class="xref page">system requirements</a> and <a href="install-production-deployment.html" class="xref page">deployment guidelines</a>, paying particular attention to the following pages:</p> </div> <div class="ulist"> <ul> <li> <p><a href="best-practices-vm.html" class="xref page">Deployment Considerations for Virtual Machines and Containers</a></p> </li> <li> <p><a href="deployment-considerations-lt-3nodes.html" class="xref page">Two-Node and Single-Node Clusters</a>.</p> </li> </ul> </div> </td> </tr> </table> </div> <div class="olist arabic"> <ol class="arabic"> <li> <p>Download and install Docker on the host computer.</p> <div class="paragraph"> <p>To set up Docker on the host computer, refer to Docker’s <a href="https://www.docker.com/get-started" target="_blank" rel="noopener">installation instructions</a>.</p> </div> </li> <li> <p>Install the official Couchbase Server container image.</p> <div class="openblock"> <div class="content"> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker run -d --name db -p 8091-8096:8091-8096 -p 11210-11211:11210-11211 couchbase</code></pre> </div> </div> <div class="sidebarblock"> <div class="content"> <div class="title">Multiple instances with Docker</div> <div class="paragraph"> <p>When running multiple instances on the same machine, make use of Docker’s <code>-p</code> option to map <code>external:internal</code> ports used by the container.</p> </div> <div class="paragraph"> <p>For example:</p> </div> <div class="paragraph"> <p><code>-p 9091:8091</code> instructs the container to map the external machine port <code>9091</code> to the container application’s port <code>8091</code>.</p> </div> </div> </div> <div class="paragraph"> <p>After running the above command, a single instance (<code>db</code>) of the latest <a href="https://hub.docker.com/_/couchbase/" target="_blank" rel="noopener">official Couchbase Server container image</a> is downloaded and run on the host computer. If a traditional installation of Couchbase Server is running locally on the host computer, the port mappings specified using the <code>-p</code> option may fail. Ensure that you stop any local instance of Couchbase Server before running this command.<br> (For instructions on starting up or shutting down a standalone instance of Couchbase server, see <a href="startup-shutdown.html" class="xref page">Starting and stopping the Couchbase Server</a>).</p> </div> <div class="paragraph"> <p>You can check the Docker logs to verify that the container has started.</p> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker logs db</code></pre> </div> </div> <div class="paragraph"> <p>If the container has started, the output should start with the following:</p> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">Starting Couchbase Server -- Web UI available at http://<ip>:8091 ...</code></pre> </div> </div> </div> </div> </li> <li> <p>From a web browser, go to <code>http://localhost:8091</code> to access the Couchbase Web Console.</p> <div class="paragraph"> <p>If the container is up and running, you should see the Couchbase Server setup screen:</p> </div> <div class="imageblock"> <div class="content"> <img src="_images/welcome.png" alt="The Couchbase Server setup screen." width="400"> </div> </div> </li> <li> <p>Click <b class="button">Setup New Cluster</b> and proceed through the setup wizard to create a cluster of one node.</p> <div class="paragraph"> <p>Refer to <a href="../manage/manage-nodes/create-cluster.html" class="xref page">Create a Cluster</a> for instructions on using the setup wizard. You may need to lower the RAM allocation for various services to fit within the bounds of the container’s resources.</p> </div> </li> </ol> </div> <div class="paragraph"> <p>Now that you have a single-node Couchbase cluster running in containers, you can move on to <a href="#section_pfz_p1r_42b">Next Steps</a>.</p> </div> </div> </div> <div class="sect1"> <h2 id="section_msh_fbl_42b"><a class="anchor" href="#section_msh_fbl_42b"></a>Deploy a Multi-Node Cluster with Containers</h2> <div class="sectionbody"> <div class="paragraph"> <p>There are two popular topologies for multi-node container deployments of Couchbase Server:</p> </div> <div class="dlist"> <dl> <dt class="hdlist1"><a href="#multi-node-cluster-one-host">All Containers on One Host</a></dt> <dd> <p>This model is commonly used for scale-minimized deployments that simulate production deployments for development and testing purposes.</p> </dd> <dt class="hdlist1"><a href="#multi-node-cluster-many-hosts">Each Container on Its Own Host</a></dt> <dd> <p>This model is commonly used for production deployments.</p> </dd> </dl> </div> <div class="admonitionblock note"> <table> <tr> <td class="icon"> <i class="fa icon-note" title="Note"></i> </td> <td class="content"> <div class="paragraph"> <p>For detailed information about deploying Couchbase Server, make sure to review the Couchbase Server <a href="plan-for-production.html" class="xref page">system requirements</a> and <a href="install-production-deployment.html" class="xref page">deployment guidelines</a>, paying particular attention to <a href="best-practices-vm.html" class="xref page">Deployment Considerations for Virtual Machines and Containers</a>.</p> </div> </td> </tr> </table> </div> <div class="sect2"> <h3 id="multi-node-cluster-one-host"><a class="anchor" href="#multi-node-cluster-one-host"></a>All Containers on One Host</h3> <div class="paragraph"> <p>In this cluster deployment model, all node containers are placed on the same physical host computer. When all containers run on a single physical host, it’s important to remember that all containers will compete for the same resources. For this reason, it’s not recommended to use this deployment model for use with applications that are sensitive to performance.</p> </div> <div class="paragraph"> <p>The following procedure explains how to set up a three-node Couchbase cluster with all the containers running on one physical host.</p> </div> <div id="ol_v2q_h2l_42b" class="olist arabic"> <ol class="arabic"> <li> <p>Download and install Docker on the host computer.</p> <div class="paragraph"> <p>To set up Docker on the host computer, refer to Docker’s <a href="https://www.docker.com/get-started" target="_blank" rel="noopener">installation instructions</a>.</p> </div> </li> <li> <p>Install three instances of the official Couchbase Server container image.</p> <div class="paragraph"> <p>Make sure to run each of the following commands:</p> </div> <div class="openblock"> <div class="content"> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker run -d --name db1 couchbase</code></pre> </div> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker run -d --name db2 couchbase</code></pre> </div> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker run -d --name db3 -p 8091-8096:8091-8096 -p 11210-11211:11210-11211 couchbase</code></pre> </div> </div> <div class="paragraph"> <p>After running the above commands, three instances (<code>db1</code>, <code>db2</code>, <code>db3</code>) of the latest <a href="https://hub.docker.com/_/couchbase/" target="_blank" rel="noopener">official Couchbase Server container image</a> are downloaded and run on the host computer. If a traditional installation of Couchbase Server is running locally on the host computer, the port mappings specified using the <code>-p</code> option may fail. Ensure that you stop any local instance of Couchbase Server before running these commands.<br> (For instructions on starting up or shutting down a standalone instance of Couchbase server, see <a href="startup-shutdown.html" class="xref page">Starting and stopping the Couchbase Server</a>).</p> </div> <div class="admonitionblock note"> <table> <tr> <td class="icon"> <i class="fa icon-note" title="Note"></i> </td> <td class="content"> If you’re using encrypted communication for the Couchbase Web Console, client, and server, and using XDCR, you need to open up additional ports. For details, refer to <a href="install-ports.html" class="xref page">Couchbase Server Ports</a>. </td> </tr> </table> </div> <div class="paragraph"> <p>You can check the Docker logs to verify that each container has started:</p> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker logs db1</code></pre> </div> </div> <div class="paragraph"> <p>If the container has started, the output should start with the following:</p> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">Starting Couchbase Server -- Web UI available at http://<ip>:8091 ...</code></pre> </div> </div> </div> </div> </li> <li> <p>Discover the local IP addresses of <code>db1</code> and <code>db2</code>.</p> <div class="openblock"> <div class="content"> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' db1</code></pre> </div> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' db2</code></pre> </div> </div> <div class="paragraph"> <p>If the above commands return an empty result, then run the following commands to discover the local IP addresses:</p> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' db1</code></pre> </div> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' db2</code></pre> </div> </div> <div class="paragraph"> <p>You’ll need these IP addresses later to add <code>db1</code> and <code>db2</code> into the cluster. (The initial cluster setup will be run from <code>db3</code>, so there is no need for its IP address.)</p> </div> </div> </div> </li> <li> <p>From a web browser, go to <code>http://localhost:8091</code> to access the Couchbase Web Console.</p> <div class="paragraph"> <p>If <code>db3</code> is up and running, you should see the Couchbase Server setup screen:</p> </div> <div class="imageblock"> <div class="content"> <img src="_images/welcome.png" alt="The Couchbase Server setup screen." width="400"> </div> </div> </li> <li> <p>Click <b class="button">Setup New Cluster</b> and proceed through the setup wizard as normal.</p> <div class="paragraph"> <p>Refer to <a href="../manage/manage-nodes/create-cluster.html" class="xref page">Create a Cluster</a> for instructions on using the setup wizard. You may need to lower the RAM allocation for various services to fit within the bounds of the container’s resources.</p> </div> </li> <li> <p>After the cluster is initialized on the first Couchbase Server node (<code>db3</code>), the next step is to add the Couchbase Server nodes from <code>db1</code> and <code>db2</code> to the cluster.</p> <div class="openblock"> <div class="content"> <div class="olist loweralpha"> <ol class="loweralpha" type="a"> <li> <p>In the Couchbase Web Console, go to the <strong class="ui">Servers</strong> tab and click <strong class="ui">ADD SERVER</strong>. This opens the <strong class="ui">Add Server Node</strong> dialog.</p> <div class="paragraph"> <p>In the <strong class="ui">Hostname/IP Address</strong> field, enter the IP address that you previously captured for <code>db1</code>. Click <b class="button">Add Server</b> to add the node to the cluster configuration.</p> </div> <div class="imageblock"> <div class="content"> <img src="_images/cluster-setup-add-server-db1.png" alt="The 'Add Server Node' dialog showing an IP address having been entered." width="450"> </div> </div> </li> <li> <p>After <code>db1</code> is successfully added to the cluster configuration, repeat the previous step using the IP address that you captured for <code>db2</code>.</p> </li> <li> <p>Once <code>db1</code> and <code>db2</code> have successfully been added to the cluster configuration, click <b class="button">Rebalance</b> to make the new nodes active in the cluster.</p> <div class="imageblock"> <div class="content"> <img src="_images/docker-single-machine-db123.png" alt="The 'Servers' tab showing three nodes in the process of rebalancing."> </div> </div> </li> </ol> </div> </div> </div> </li> </ol> </div> <div class="paragraph"> <p>Now that you have a multi-node Couchbase cluster running in containers on a single host, you can move on to <a href="#section_pfz_p1r_42b">Next Steps</a>.</p> </div> </div> <div class="sect2"> <h3 id="multi-node-cluster-many-hosts"><a class="anchor" href="#multi-node-cluster-many-hosts"></a>Each Container on Its Own Host</h3> <div class="paragraph"> <p>In this cluster deployment model, each node container is placed on its own physical host computer. This is the supported model for Couchbase Server container deployments in production.</p> </div> <div class="paragraph"> <p>The following procedure explains how to set up a three-node Couchbase cluster with each container running on its own physical host. Note that all physical hosts must be able to discover one another on the same network and be able to communicate over the <a href="install-ports.html" class="xref page">required ports</a>.</p> </div> <div id="ol_txh_tlm_42b" class="olist arabic"> <ol class="arabic"> <li> <p>Download and install Docker on each host computer.</p> <div class="paragraph"> <p>To set up Docker on each host computer, refer to Docker’s <a href="https://www.docker.com/get-started" target="_blank" rel="noopener">installation instructions</a>.</p> </div> </li> <li> <p>On each of the three physical hosts, install the official Couchbase Server container image.</p> <div class="openblock"> <div class="content"> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker run -d --name db -v ~/couchbase:/opt/couchbase/var --net=host couchbase</code></pre> </div> </div> <div class="paragraph"> <p>After running the above command, a single instance (<code>db</code>) of the latest <a href="https://hub.docker.com/_/couchbase/" target="_blank" rel="noopener">official Couchbase Server container image</a> is downloaded and run on the host computer. The <code class="cmd">-v</code> option is recommended for better I/O performance and persists the data stored by Couchbase on the local host. The <code>--net=host</code> option provides better network performance and maps the host network stack to the container.</p> </div> <div class="paragraph"> <p>You can check the Docker logs to verify that the container has started.</p> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker logs db</code></pre> </div> </div> <div class="paragraph"> <p>If the container has started, the output should start with the following:</p> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">Starting Couchbase Server -- Web UI available at http://<ip>:8091 ...</code></pre> </div> </div> </div> </div> </li> <li> <p>On each physical host, discover the local IP address for the Couchbase Server container.</p> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">docker inspect --format '{{ .NetworkSettings.IPAddress }}' db</code></pre> </div> </div> <div class="paragraph"> <p>You’ll need these IP addresses later to add each node into the cluster.</p> </div> </li> <li> <p>On one of the physical hosts, open a web browser and go to <code>http://localhost:8091</code> or <code>http://<node-ip>:8091</code> to access the Couchbase Web Console.</p> <div class="paragraph"> <p>If the Couchbase Server container is up and running, you should see the Couchbase Server setup screen:</p> </div> <div class="imageblock"> <div class="content"> <img src="_images/welcome.png" alt="The Couchbase Server setup screen." width="400"> </div> </div> </li> <li> <p>Click <b class="button">Setup New Cluster</b> and proceed through the setup wizard as normal.</p> <div class="paragraph"> <p>Refer to <a href="../manage/manage-nodes/create-cluster.html" class="xref page">Create a Cluster</a> for instructions on using the setup wizard.</p> </div> </li> <li> <p>After the cluster is initialized on the first host, the next step is to incorporate the other Couchbase Server nodes running on the other hosts.</p> <div class="openblock"> <div class="content"> <div class="olist loweralpha"> <ol class="loweralpha" type="a"> <li> <p>In the Couchbase Web Console on the host you just initialized, go to the <strong class="ui">Servers</strong> tab and click <strong class="ui">ADD SERVER</strong>. This opens the <strong class="ui">Add Server Node</strong> dialog.</p> <div class="paragraph"> <p>In the <strong class="ui">Hostname/IP Address</strong> field, enter the IP address of one of the other nodes that you captured previously. Click <b class="button">Add Server</b> to add the node to the cluster configuration.</p> </div> <div class="imageblock"> <div class="content"> <img src="_images/cluster-setup-add-server-db1.png" alt="The 'Add Server Node' dialog showing an IP address having been entered." width="450"> </div> </div> </li> <li> <p>Once the second node has been successfully added to the cluster configuration, repeat the previous step using the IP address of the third and final node.</p> </li> <li> <p>Once all three nodes have been successfully added to the cluster configuration, click <b class="button">Rebalance</b> to make the new nodes active in the cluster.</p> <div class="imageblock"> <div class="content"> <img src="_images/docker-single-machine-db123.png" alt="The 'Servers' tab showing three nodes in the process of rebalancing."> </div> </div> </li> </ol> </div> </div> </div> </li> </ol> </div> <div class="paragraph"> <p>Now that you have a multi-node Couchbase cluster running in containers across multiple physical hosts, you can move on to <a href="#section_pfz_p1r_42b">Next Steps</a>.</p> </div> </div> </div> </div> <div class="sect1"> <h2 id="section_deploy_multiple_clusters"><a class="anchor" href="#section_deploy_multiple_clusters"></a>Deploy Multiple Clusters with Containers</h2> <div class="sectionbody"> <div class="paragraph"> <p>In this cluster deployment model, each cluster, running one or more nodes, is run in a separate container. All the containers run on a single physical host. When all containers run on a single physical host, it’s important to remember that all containers will compete for the same resources. For this reason, it’s not recommended to use this deployment model for use with applications that are sensitive to performance.</p> </div> <div class="paragraph"> <p>The following procedure explains how to set up two clusters, each in a separate container, all running on one physical host.</p> </div> <div class="olist arabic"> <ol class="arabic"> <li> <p>Download and install Docker on the host computer.</p> <div class="paragraph"> <p>To set up Docker on the host computer, refer to Docker’s <a href="https://www.docker.com/get-started" target="_blank" rel="noopener">installation instructions</a>.</p> </div> </li> <li> <p>Install two instances of the official Couchbase Server container image.</p> <div class="paragraph"> <p>Make sure to run each of the following commands:</p> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker run -d --name db1 -p 8091-8096:8091-8096 -p 11210-11211:11210-11211 couchbase</code></pre> </div> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker run -d --name db2 -p 9091-9096:8091-8096 -p 21210-21211:11210-11211 couchbase</code></pre> </div> </div> <div class="paragraph"> <p>After running the above commands, two instances (<code>db1</code> and <code>db2</code>) of the latest <a href="https://hub.docker.com/_/couchbase/" target="_blank" rel="noopener">official Couchbase Server container image</a> are downloaded and run on the host computer. If a traditional installation of Couchbase Server is running locally on the host computer, the port mappings specified using the <code>-p</code> option may fail. Ensure that you stop any local instance of Couchbase Server before running these commands.<br> (For instructions on starting up or shutting down a standalone instance of Couchbase server, see <a href="startup-shutdown.html" class="xref page">Starting and stopping the Couchbase Server</a>).</p> </div> <div class="admonitionblock note"> <table> <tr> <td class="icon"> <i class="fa icon-note" title="Note"></i> </td> <td class="content"> If you’re using encrypted communication for the Couchbase Web Console, client, and server, and using XDCR, you need to open up additional ports. For details, refer to <a href="install-ports.html" class="xref page">Couchbase Server Ports</a>. </td> </tr> </table> </div> </li> <li> <p>You can check the Docker logs to verify that each container has started:</p> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker logs db1</code></pre> </div> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker logs db2</code></pre> </div> </div> <div class="paragraph"> <p>If the containers have started successfully, then each one will return the following output:</p> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">Starting Couchbase Server -- Web UI available at http://<ip>:8091 ...</code></pre> </div> </div> </li> <li> <p>Discover the local IP addresses of <code>db1</code> and <code>db2</code>.</p> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' db1</code></pre> </div> </div> <div class="listingblock"> <div class="content"> <pre class="highlightjs highlight"><code class="language-console hljs" data-lang="console">$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' db2</code></pre> </div> </div> <div class="paragraph"> <p>Note down the IP addresses as these will be needed for configuring the server nodes.</p> </div> <div class="paragraph"> <p>Each instance is a Couchbase cluster, so you will need to access the UI for each cluster to add a server node.</p> </div> <table class="tableblock frame-all grid-all stretch"> <caption class="title">Table 1. Accessing the server UI</caption> <colgroup> <col style="width: 50%;"> <col style="width: 50%;"> </colgroup> <thead> <tr> <th class="tableblock halign-left valign-top">Instance</th> <th class="tableblock halign-left valign-top">Address</th> </tr> </thead> <tbody> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">db1</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="http://localhost:8091" class="bare">http://localhost:8091</a></p></td> </tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">db2</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="http://localhost:9091" class="bare">http://localhost:9091</a></p></td> </tr> </tbody> </table> <div class="paragraph"> <p>Refer to <a href="../manage/manage-nodes/create-cluster.html" class="xref page">Create a Cluster</a> for instructions on using the setup wizard. You may need to lower the RAM allocation for various services to fit within the bounds of the container’s resources.</p> </div> </li> </ol> </div> </div> </div> <div class="sect1"> <h2 id="section_pfz_p1r_42b"><a class="anchor" href="#section_pfz_p1r_42b"></a>Next Steps</h2> <div class="sectionbody"> <div class="paragraph"> <p>Once you’ve successfully initialized a Couchbase cluster running in containers, you can start installing and querying <a href="../manage/manage-settings/install-sample-buckets.html" class="xref page">sample buckets</a>, as well as begin connecting clients.</p> </div> <div class="ulist"> <ul> <li> <p><a href="../getting-started/try-a-query.html" class="xref page">Run Your First SQL++ Query</a></p> <div class="paragraph"> <p>If you would like to practice querying on a new Couchbase cluster, log into the Couchbase Web Console at <code>http://localhost:8091</code> and go to the <strong class="ui">Query</strong> tab. If you don’t have any buckets set up yet, you can go to the <strong class="ui">Buckets</strong> tab and click <strong class="ui">sample bucket</strong> to load some sample data.</p> </div> </li> <li> <p>Connect via SDK</p> <div class="paragraph"> <p>The SDKs communicate with Couchbase Server services over various ports using the name that is used to register each node in the <strong class="ui">Servers</strong> tab. Given that each node is registered using the IP address of the hosts, applications using the SDK can be run from any host that can reach the nodes of the cluster.</p> </div> <div class="paragraph"> <p>For single-node clusters, simply run your application through the Couchbase Server SDK on the host and point it to <code>http://localhost:8091/pools</code> to connect to the container.</p> </div> <div class="paragraph"> <p>For more information about deploying a sample application, refer to the <a href="../../../java-sdk/current/hello-world/sample-application.html" class="xref page">SDK documentation</a>.</p> </div> </li> </ul> </div> </div> </div> </article> </main> </div> <footer class="footer"> <div class="container"> <div class="footer-links"> <div class="col"> <div class="footer-logo"> <a href="https://www.couchbase.com" class="icon"> <img src="../../../_/img/couchbase-logo.svg" alt="Couchbase"> </a> </div> </div> <div class="col"> <ul> <li><a href="https://docs.couchbase.com" target="_blank" rel="noopener">Documentation</a></li> <li><a href="https://forums.couchbase.com" target="_blank" rel="noopener">Forums</a></li> <li><a href="https://support.couchbase.com" target="_blank" rel="noopener">Support</a></li> </ul> </div> <div class="col"> <ul> <li><a href="https://developer.couchbase.com" target="_blank" rel="noopener">Developer Portal</a></li> <li><a href="https://blog.couchbase.com" target="_blank" rel="noopener">Blog</a></li> <li><a href="https://www.couchbase.com/resources">Resources</a></li> </ul> </div> <div class="col"> <ul> <li><a href="https://www.couchbase.com/get-started-developing-nosql">Get Started</a></li> <li><a href="https://www.couchbase.com/downloads">Downloads</a></li> <li><a href="https://learn.couchbase.com/store?utf8=%E2%9C%93&ss=1&ct=78327&commit=Filter" target="_blank" rel="noopener">Training</a></li> </ul> </div> <div class="col"> <ul class="social-icons"> <li> <svg width="14" height="14" viewBox="0 0 32.1 26.1"> <path id="twitter" class="cls-1" d="M32,7.1a11.836,11.836,0,0,1-3.8,1,6.462,6.462,0,0,0,2.9-3.6,12.606,12.606,0,0,1-4.2,1.6A6.492,6.492,0,0,0,22.1,4a6.594,6.594,0,0,0-6.6,6.6,7.719,7.719,0,0,0,.2,1.5A18.458,18.458,0,0,1,2.2,5.2a6.294,6.294,0,0,0-.9,3.3A6.765,6.765,0,0,0,4.2,14a6.109,6.109,0,0,1-3-.8v.1a6.543,6.543,0,0,0,5.3,6.4,4.678,4.678,0,0,1-1.7.2,4.869,4.869,0,0,1-1.2-.1,6.679,6.679,0,0,0,6.1,4.6,12.917,12.917,0,0,1-8.2,2.8,9.151,9.151,0,0,1-1.6-.1,18.438,18.438,0,0,0,10.1,3c12.1,0,18.7-10,18.7-18.7v-.8A13.336,13.336,0,0,0,32,7.2Z" transform="translate(0.1 -4)"/></svg> <a href="https://twitter.com/couchbase" class="icon"> Twitter </a> </li> <li> <svg width="14" height="14" viewBox="0 0 32 32"> <path id="linkedin" class="cls-1" d="M29,0H3A3.076,3.076,0,0,0,0,3V29a3.009,3.009,0,0,0,3,3H29a2.946,2.946,0,0,0,3-3V3A3.009,3.009,0,0,0,29,0ZM12,26H8V12h4ZM10,10a2,2,0,1,1,2-2A2.006,2.006,0,0,1,10,10ZM26,26H22V18a2,2,0,0,0-4,0v8H14V12h4v2.5c.8-1.1,2.1-2.5,3.5-2.5A4.736,4.736,0,0,1,26,17Z"/></svg> <a href="https://www.linkedin.com/company/couchbase" class="icon"> Linkedin </a> </li> <li> <svg width="14" height="14" viewBox="0 0 32 32"> <path id="facebook" class="cls-1" d="M29,0H3A2.652,2.652,0,0,0,0,3V29a2.652,2.652,0,0,0,3,3H16V18H12V14h4V12a6.452,6.452,0,0,1,6-6h4v4H22a2.151,2.151,0,0,0-2,2v2h6l-1,4H20V32h9a2.652,2.652,0,0,0,3-3V3A2.652,2.652,0,0,0,29,0Z"/></svg> <a href="https://www.facebook.com/Couchbase" class="icon"> Facebook </a> </li> </ul> </div> </div> <div class="footer-terms"> <div class="footer-terms-copyright"> <span>漏 2025 Couchbase and the Couchbase logo are registered trademarks of Couchbase, Inc. All third party trademarks (including logos and icons) referenced by Couchbase, Inc. remain the property of their respective owners. </span> </div> <div class="footer-terms-links"> <a href="https://www.couchbase.com/terms-of-use">Terms of Use</a> <a href="https://www.couchbase.com/privacy-policy">Privacy Policy</a> <a href="https://www.couchbase.com/cookie-policy">Cookie Policy</a> <a href="https://www.couchbase.com/support-policy">Support Policy</a> <a href="https://info.couchbase.com/unsubscribe-or-manage-preferences.html" target="_blank" rel="noopener">Marketing Preference Center</a> </div> </div> </div> </footer> <script src="../../../_/js/site-navigation-data.js"></script> <script id="page-navigation-group" type="application/json"> {"title":"Server","components":["server"],"url":"/home/server.html","latestVersions":{"server":"7.6"}} </script> <template id="run-code-panel"> <div class="action-panel"> <form class="action-panel-control" method="POST" action="https://couchbase.live/run" target="run-code-output"> <input type="hidden" name="lang"> <input type="hidden" name="code"> <input type="hidden" name="from" value="docs"> <div class="controls"> <button class="control-button rerun" type="submit"><i class="fas fa-redo"></i></button> <span class="shell-name control-label">Output</span> <button class="control-button close"><i class="fas fa-times"></i> Close</button> </div> </form> <iframe class="run-code-output" name="run-code-output"></iframe> </div> </template> <script id="site-script" src="../../../_/js/vendor/chatbox-ui.js"></script> <script id="site-script" src="../../../_/js/site.js"></script> <script async src="../../../_/js/vendor/tabs.js" data-sync-storage-key="preferred-tab"></script> <script defer src="../../../_/js/vendor/fontawesome-icon-defs.js"></script> <script defer src="../../../_/js/vendor/fontawesome.js" data-search-pseudo-elements="true"></script> <script async src="../../../_/js/vendor/highlight.js"></script> <script async id="search-script" src="../../../_/js/vendor/docsearch.js" data-app-id="NI1G57N08Q" data-api-key="0b46f6ae103569b12c0d4bfe4842f4ba" data-index-name="hosted-crawler-docs-site-index" data-stylesheet="../../../_/css/vendor/docsearch.css"></script> <script async id="feedback-script" src="../../../_/js/vendor/feedback.js?v=1" data-collector-id="709818cb"></script> </body> </html>