Skip to content

Commit 60fc8c7

Browse files
authored
(DOCSP-34859): Added local deploy in docker. (#247)
* (DOCSP-34859): Added local deploy in docker. * (DOCSP-34859): Incorporated Sarah's feedback. * (DOCSP-34859): Incorporated Jakub's feedback. * (DOCSP-34859): Incorporated final comments.
1 parent 30a49fa commit 60fc8c7

File tree

3 files changed

+182
-0
lines changed

3 files changed

+182
-0
lines changed

source/atlas-cli-deploy-docker.txt

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
.. _atlas-cli-deploy-docker:
2+
3+
===========================================
4+
Create a Local Atlas Deployment with Docker
5+
===========================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. facet::
10+
:name: genre
11+
:values: tutorial
12+
13+
.. contents:: On this page
14+
:local:
15+
:backlinks: none
16+
:depth: 1
17+
:class: singlecol
18+
19+
This tutorial shows you how to use the :ref:`atlas-deployments` command
20+
to create a local |service| deployment with Docker. In this tutorial,
21+
we will deploy a single-node replica set with Docker.
22+
23+
.. include:: /includes/fact-atlas-deployments-preview.rst
24+
25+
.. _atlas-cli-deploy-docker-setup:
26+
27+
Create a Local Atlas Deployment with Docker
28+
-------------------------------------------
29+
30+
Use the ``atlas deployments`` command to create a local |service|
31+
deployment with Docker.
32+
33+
.. procedure::
34+
:style: normal
35+
36+
.. step:: Install and start Docker.
37+
38+
To learn more, see the `Docker documentation <https://docs.docker.com/desktop/install/mac-install/>`__.
39+
40+
.. step:: Pull down the latest ``mongodb/atlas`` Docker image.
41+
42+
**Example:**
43+
44+
.. code-block:: sh
45+
46+
docker pull mongodb/atlas:latest
47+
48+
.. step:: Run the Docker image in bash mode.
49+
50+
To learn more, see :ref:`atlas-cli-docker`.
51+
52+
**Example:**
53+
54+
.. code-block:: sh
55+
56+
docker run -p 27777:27017 --privileged -it mongodb/atlas bash
57+
58+
.. step:: Create a local |service| deployment.
59+
60+
The following command creates a local |service| deployment with
61+
|fts| capabilities enabled. It also returns a connection string.
62+
63+
**Example:**
64+
65+
.. code-block::
66+
67+
atlas deployments setup --bindIpAll --username root --password root --type local --force
68+
69+
To learn more about the available options, see
70+
:ref:`atlas-deployments-setup`.
71+
72+
.. step:: Connect to the local |service| deployment.
73+
74+
To connect to the local |service| deployment from the host (not
75+
container), copy and paste the following command, and replace
76+
the ``{connection_string}`` variable with your connection string.
77+
78+
.. note::
79+
80+
The following example uses {+mongosh+}, but you can use the
81+
connection method that you prefer.
82+
83+
.. code-block:: sh
84+
85+
mongosh {connection_string}
86+
87+
**Example:**
88+
89+
.. code-block:: sh
90+
91+
mongosh mongodb://root:root@localhost:27017/?directConnection=true
92+
93+
94+
Create a Local Atlas Deployment with Docker Compose
95+
---------------------------------------------------
96+
97+
Use the ``atlas deployments`` command to create a local |service|
98+
deployment with `Docker Compose <https://docs.docker.com/compose/>`__.
99+
100+
.. procedure::
101+
:style: normal
102+
103+
.. step:: Install Docker Compose.
104+
105+
**Example:**
106+
107+
.. code-block:: sh
108+
109+
brew install docker-compose
110+
111+
.. step:: Create a ``docker-compose.yaml`` file.
112+
113+
Create the ``docker-compose.yaml`` file in the same directory
114+
that you run Docker Compose from.
115+
116+
**Example:**
117+
118+
.. code-block:: sh
119+
120+
services:
121+
mongo:
122+
image: mongodb/atlas
123+
privileged: true
124+
command: |
125+
/bin/bash -c "atlas deployments setup --type local --port 27778 --bindIpAll --username root --password root --force && tail -f /dev/null"
126+
volumes:
127+
- /var/run/docker.sock:/var/run/docker.sock
128+
ports:
129+
- 27778:27778
130+
131+
To learn more about the available options, see
132+
:ref:`atlas-deployments-setup`.
133+
134+
.. step:: Run Docker Compose.
135+
136+
The following command creates a local |service| deployment with
137+
|fts| capabilities enabled. It also returns a connection string.
138+
139+
**Example:**
140+
141+
.. code-block:: sh
142+
143+
docker-compose up
144+
145+
.. step:: Connect to the local |service| deployment.
146+
147+
To connect to the local |service| deployment from the host (not
148+
container), copy and paste the following command, and replace
149+
the ``{connection_string}`` variable with your connection string.
150+
151+
.. note::
152+
153+
The following example uses {+mongosh+}, but you can use the
154+
connection method that you prefer.
155+
156+
.. code-block:: sh
157+
158+
mongosh {connection_string}
159+
160+
**Example:**
161+
162+
.. code-block:: sh
163+
164+
mongosh mongodb://root:root@localhost:27778/?directConnection=true
165+
166+
Supported Actions
167+
-----------------
168+
169+
To learn all of the actions that ``atlas deployments`` supports, see
170+
:ref:`atlas-deployments`.

source/atlas-cli-docker.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ To learn more about interactive mode and detached mode, see `docker run
2525
For more information on our Atlas CLI docker image, see our
2626
`Docker Hub repository <https://hub.docker.com/r/mongodb/atlas>`__.
2727

28+
You can also create a local |service| deployment with Docker. To learn
29+
more, see :ref:`atlas-cli-deploy-docker`.
30+
2831
.. _atlas-cli-docker-reqs:
2932

3033
Complete The Prerequisites

source/atlas-cli-local-cloud.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Manage Local and Cloud Deployments from the {+atlas-cli+}
66

77
.. default-domain:: mongodb
88

9+
.. facet::
10+
:name: genre
11+
:values: reference
12+
913
.. contents:: On this page
1014
:local:
1115
:backlinks: none
@@ -89,6 +93,10 @@ deployments`` commands:
8993
deployment. This tutorial deploys a single-node replica set on
9094
your local computer.
9195

96+
* - :ref:`atlas-cli-deploy-docker`
97+
- Use the ``atlas deployments`` command to create a local |service|
98+
deployment with Docker.
99+
92100
* - :ref:`atlas-cli-deploy-fts`
93101
- Use the ``atlas deployments search indexes create`` command to
94102
manage |fts| indexes and work with {+avs+} locally and in the
@@ -98,5 +106,6 @@ deployments`` commands:
98106
:titlesonly:
99107

100108
Create a Local Deployment </atlas-cli-deploy-local>
109+
Deploy with Docker </atlas-cli-deploy-docker>
101110
Use Atlas Search </atlas-cli-deploy-fts>
102111

0 commit comments

Comments
 (0)