Skip to content

Commit 0a2875e

Browse files
committed
Added stack.yml
1 parent 739ae9a commit 0a2875e

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

mongo/content.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,9 @@ $ docker run -it --link some-%%REPO%%:mongo --rm %%IMAGE%% sh -c 'exec mongo "$M
3434
```
3535
... where `some-mongo` is the name of your original `mongo` container.
3636

37-
## ... via `docker-compose`
37+
## %%STACK%%
3838

39-
Example `docker-compose.yml` for `mongo`:
40-
41-
```
42-
version: '2.1'
43-
44-
services:
45-
46-
db:
47-
image: %%IMAGE%%
48-
restart: always
49-
environment:
50-
MONGO_INITDB_ROOT_USERNAME: MongoRootUser
51-
MONGO_INITDB_ROOT_PASSWORD: AMuchStrongerPassword
52-
53-
app:
54-
build: ./app
55-
ports:
56-
- 80:80
57-
links:
58-
- db
59-
```
39+
Run `docker stack deploy -c stack.yml %%REPO%%` (or `docker-compose -f stack.yml up`), wait for it to initialize completely, and visit `http://swarm-ip:8081`, `http://localhost:8081`, or `http://host-ip:8081` (as appropriate).
6040

6141
## Container shell access and viewing Mongo logs
6242

mongo/stack.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Use root/example as user/password credentials
2+
version: '3.1'
3+
4+
services:
5+
6+
mongo:
7+
image: mongo
8+
# image: %%IMAGE%%
9+
restart: always
10+
environment:
11+
MONGO_INITDB_ROOT_USERNAME: root
12+
MONGO_INITDB_ROOT_PASSWORD: example
13+
14+
mongo-express:
15+
image: mongo-express
16+
restart: always
17+
ports:
18+
- 8081:8081
19+
environment:
20+
ME_CONFIG_MONGODB_ADMINUSERNAME: root
21+
ME_CONFIG_MONGODB_ADMINPASSWORD: example

0 commit comments

Comments
 (0)