REDIS+MONGODB Two db is used in demo environment, so you can use Docker Redids and MongoDB image directly, and use Docker-compose for federated deployment.
The following versions are used:
Docker: Using Yum-y install Docker
Docker-compose: use pip install Docker-compose
Mongodb:docker Pull mongodb:3.6.5
Redis:docker Pull redis:4.0.10
Docker-compose configuration file used by Docker-compose.yml:
Where MongoDB's entrypoint-initdb.d startup script file is as follows:
Precautions:
1. Installation of Docker-compose, using two installation methods, one is yum-y install Docker-compose, the second is pip install Docker-compose
Do not want to toss or must use the new version of the case, the proposal with the first kind of bar, more worry. The second can install the latest version, but will encounter a variety of library version dependencies, the most common is the version of requests dependency,
Due to the different requirements for Docker and docker-compose dependent versions, it is easiest to install their common version to support both the Docker version and the Docker-compose version.
Valueerror:timeout value Connect is Timeout (Connect=none, Read=none, Total=none), but it must is an int, float or None. Error
A relatively quick solution is:
(1). Pip uninstall Docker-compose, pip uninstall Docker, Pip Unstall requests (here is the focus, may have installed several versions of requests and must uninstall all versions)
(2). Pip install docker, pip install Docker-compose
Associating related versions automatically with PIP
2. In the toss MongoDB startup script (mainly in order to start to create the user and password), constantly modify the test docker-compose.yml configuration file, it should be noted that the top yml inside the configuration, the MongoDB/data/db folder
Mapped to local, but when the configuration file is modified to test, it is best to clean up the files generated in mongodb/data/db, and if you use docker-compose up to directly observe the log output, if the test is finished Docker-compose
Terminal, you must perform a docker-compose down operation to clean up the generated container.
The above approach, mainly to prevent the pre-modification of the configuration file has generated some cache, resulting in modification of the configuration file after the execution is still cached results
Docker-compose Deployment Mongodb+redis Problems encountered