ERROR: Named volume "mongodb_config:/data/configdb:rw" is used in service "mongo" but no declaration was found in the volumes section - mongodb

I am having this error while running my docker- compose command "docker-compose up -d mongo". Please help me to find a solution . Thanks in advance .
My docker-compose.yml looks like this .
version: '3'
services:
mongo:
image: mongo:4.2.0
ports:
- "27017:27017"
volumes:
- mongodb:/data/db
- mongodb_config:/data/configdb
mongo-express:
image: mongo-express
restart: unless-stopped
ports:
- "8081:8081"
volumes:
mongo:
external: true
please help .

The error message means you should create the volume first. Try this:
version: '3'
services:
mongo:
image: mongo:4.2.0
ports:
- "27017:27017"
volumes:
- mongodb:/data/db
- mongodb_config:/data/configdb
mongo-express:
image: mongo-express
restart: unless-stopped
ports:
- "8081:8081"
volumes: # use volume by local driver, so you can use the volume directly
mongodb:
driver: local
mongodb_config:
driver: local
See also Use volumes

Related

How to use data from MongoDB in docker container on Typesense in the same container?

Description
I have a container that has a mongodb, mongo-express and typesense. I need to set that typesense use data from the mongodb inside the container. How can i do this?
I already used and configured the replica set.
Steps to reproduce
This is my docker compose file:
version: "3.9"
services:
database:
image : 'mongo'
container_name: 'container-name'
environment:
- PUID=1000
- PGID=1000
volumes:
- ./database:/data/db
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs0" ]
ports:
- 27017:27017
restart: unless-stopped
mongo-express:
image: mongo-express:0.54
ports:
- "8081:8081"
environment:
ME_CONFIG_MONGODB_SERVER: database
depends_on:
- database
typesense:
image: typesense/typesense:0.21.0
ports:
- "8108:8108"
environment:
TYPESENSE_API_KEY: xyz
TYPESENSE_DATA_DIR: /data/typesense
TYPESENSE_ENABLE_CORS: "true"
volumes:
- ./typesense:/data/typesense
When i call the API colletions/data, i get a response and on the end i see num_documents: 0
Github answer

Docker pgadmin 4 - error: "does not appear to be a valid email address. Please reset the PGADMIN_DEFAULT_EMAIL environment variable"

Please bear with me, I'm rather new to docker.
I've got the following docker-compose.yaml file from my colleague who runs this on windows - apparently without problems:
version: "3.3"
services:
mysql-server:
image: mysql:8.0.19
restart: always
environment:
MYSQL_ROOT_PASSWORD: secret
volumes:
- mysql-data:/var/lib/mysql
ports:
- "33061:33061"
phpmyadmin:
image: phpmyadmin/phpmyadmin:5.1.1
restart: always
environment:
PMA_HOST: mysql-server
PMA_USER: ${PMA_USER}
PMA_PASSWORD: ${PMA_PASSWORD}
UPLOAD_LIMIT: 256M
MAX_EXECUTION_TIME: 0
ports:
- "8080:80"
volumes:
- ./database/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
postgresdb:
container_name: pg_container
image: postgres:latest
restart: always
ports:
- "54321:54321"
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
volumes:
- postgres:/var/lib/postgresql/data
pgadmin:
container_name: pgadmin_container
depends_on:
- postgresdb
image: dpage/pgadmin4:5
restart: always
ports:
- "5556:80"
environment:
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL}
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD}
volumes:
- pgadmin:/var/lib/pgadmin
web:
build:
context: .
dockerfile: dockerfile-python
command: python3 manage.py runserver 0.0.0.0:8000
container_name: python_myApp
volumes:
- .:/theApp
ports:
- "8000:8000"
depends_on:
- postgresdb
volumes:
mysql-data:
postgres:
pgadmin:
I run it on Linux, version is: Docker version 20.10.9, build c2ea9bc
Problem is, container pgadmin won't start up - it gives me the following error:
'"server#myapp.de"' does not appear to be a valid email address. Please reset the PGADMIN_DEFAULT_EMAIL environment variable and try again.
The .env file looks like that:
PMA_USER="root"
PMA_PASSWORD="XXXX"
POSTGRES_DB='postgres'
POSTGRES_USER='admin'
POSTGRES_PASSWORD='XXXX'
PGADMIN_DEFAULT_EMAIL="server#myapp.de"
PGADMIN_DEFAULT_PASSWORD="XXXX"
I tried to reset everything by doing a
docker system prune
docker volume prune
but the error persists. What's going wrong here?
thanks!
You don't need any " in env files, just remove them
PMA_USER=root
PMA_PASSWORD=XXXX
POSTGRES_DB=postgres
POSTGRES_USER=admin
POSTGRES_PASSWORD=XXXX
PGADMIN_DEFAULT_EMAIL=server#myapp.de
PGADMIN_DEFAULT_PASSWORD=XXXX

Using several mongodbs with monstache

I have a working monstache deployment using docker for elasticsearch and mongodb synchronization. the configuration file is as shown below:
mongo-url = "mongodb://project-db:27017"
elasticsearch-urls = ["http://es7:9200"]
direct-read-namespaces = ["project.data"]
change-stream-namespaces = ["project.data"]
[logs]
error = "./logs/error.log"
[[mapping]]
namespace = "project.data"
index = "Project"
[[script]]
namespace = "project.data"
path = "./scripts/collection.js"
routing = true
However, I need to add several other databases like 10 of them. mongo-url is a string. Is there a way to add several mongodb sources for indexing?
Monstache seems reasonably light. I'd recommend using multiple dockers in a docker compose setup. Something like so:
version: '3.5'
networks:
proxynet:
name: proxynet
driver: bridge
services:
mongodb:
networks:
- mongodbnet
- proxynet
ports:
- 27017:27017
container_name: mongodb
image: mongo:4.2.17
command: --auth --replSet mongoset
volumes:
- /path/to/docker/mongodb/data:/data/db
restart: unless-stopped
elasticsearch:
container_name: elasticsearch
networks:
- proxynet
ports:
- 9200:9200
- 9300:9300
environment:
- "discovery.type=single-node"
- ELASTIC_PASSWORD=random
volumes:
- /path/to/docker/elasticsearch/data:/usr/share/elasticsearch/data
image: elasticsearch:7.5.2
restart: unless-stopped
monstache01:
networks:
- proxynet
image: rwynn/monstache
container_name: monstache
ports:
- 8080:8080
working_dir: /monstache
command: -f ./monstache.toml
volumes:
- /path/to/monstache01:/monstache
depends_on:
- elasticsearch
- mongodb
restart: unless-stopped
monstache02:
networks:
- proxynet
- mongodbnet
image: rwynn/monstache
container_name: monstache
ports:
- 8081:8080
working_dir: /monstache
command: -f ./monstache.toml
volumes:
- /path/to/docker/monstache02:/monstache
depends_on:
- elasticsearch
- mongodb
restart: unless-stopped

docker-compose failed "ERROR: The Compose file"

version: '3'
services:
mongo:
image: mongo:4.2.8
restart: unless-stopped
ports:
- 27017:27017
volumes:
- mongodb:/data/db
- mongodb_config:/data/configdb
pisignage-server:
image: pisignage/pisignage-server:latest
restart: unless-stopped
ports:
- 3000:3000
volumes:
- media:/media
- data:/data
depends_on:
mongo:
condition: service_started
volumes:
mongodb:
mongodb_config:
media:
data:
So every singe time i try to compose I get following error:
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.pisignage-server.depends_on contains an invalid type, it should be an array
Any Idea what I am missing?
#1 depends_on should be an array e.g.
Also #2
Version 3 no longer supports the condition form of depends_on.
see https://docs.docker.com/compose/compose-file/compose-file-v3/#depends_on

Saving mongo data in Windows host

I am trying to save mongodb data in Windows host, but getting an error, I want this to be happen through Docker-compose only
My Docker-compose file
version: '3'
services:
mongo:
image: mongo
restart: always
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME:
MONGO_INITDB_ROOT_PASSWORD:
volumes:
- C:\Users\sd\Desktop\Data:/data/db
mongo-express:
image: mongo-express
restart: always
ports:
- "8081:8081"
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME:
ME_CONFIG_MONGODB_ADMINPASSWORD:
volumes:
C:\Users\sd\Desktop\Data:
Getting this error
Volume value 'C:\Users\sd\Desktop\Data' doesn't match with any of the regexes: '[a-zA-Z0-9._-]+$'
I tried with
volumes:
- /C/Users/sd/Desktop/Data:/data/db
and
volumes:
- //C/Users/sd/Desktop/Data:/data/db
but still the same issue
This syntax should work (notice the minus c ) :
volumes: - //c/Users/sd/Desktop/Data:/data/db
In addition, you should add the COMPOSE_CONVERT_WINDOWS_PATHS variable :
As described here