Hi guys I hope you can help me with this problem I am trying to mount an application in a podman container. on my computer I use docker and it works perfectly but when I run it on the podman server this problem occurs. My podman versions Version: 3.3.1 API Version: 3.3.1 Go Version: go1.16.7 Built: Tue Sep 21 04:41:42 2021 OS/Arch: linux/amd64
//////////////////// podman-compose version [‘podman’, ‘–version’, ‘’] using podman version: 3.3.1 podman-composer version 1.0.3 podman --version podman version 3.3.1 exit code: 0
////////////////////////////////////////////// error at podman-compose up
Uncaught Error MongooseServerSelectionError: getaddrinfo ENOTFOUND mongo
at NativeConnection.Connection.openUri (/usr/src/app/node_modules/mongoose/lib/connection.js:807:32)
at /usr/src/app/node_modules/mongoose/lib/index.js:343:10
at /usr/src/app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:32:5
at new Promise (<anonymous>)
at promiseOrCallback (/usr/src/app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:10)
at Mongoose._promiseOrCallback (/usr/src/app/node_modules/mongoose/lib/index.js:1181:10)
at Mongoose.connect (/usr/src/app/node_modules/mongoose/lib/index.js:342:20)
at dbConnection (/usr/src/app/DB/config.js:8:11)
at Object.<anonymous> (/usr/src/app/index.js:28:1)
at Module._compile (node:internal/modules/cjs/loader:1099:14) {
reason: TopologyDescription {
type: 'Unknown',
servers: Map(1) { 'mongo:27017' => [ServerDescription] },
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
logicalSessionTimeoutMinutes: undefined
},
code: undefined
}
[nodemon] app crashed - waiting for file changes before starting...
Compiled with warnings.
/////////////////////////////////
code for config.js
const mongoose = require("mongoose");
const dbConnection = async()=>{
try{
mongoose.connect('mongodb://mongo:27017/Forms2', {
useNewUrlParser: true,
useUnifiedTopology: true
});
console.log('MongoDB activa');
}catch(error){
console.log(error);
throw new Error('error iniciando MongoDB');
process.exit(1);
}
}
module.exports ={
dbConnection
}
//////////////////////
docker-copose.yml
version: '3'
services:
react-app:
image: react-app
build: ./frontend/
stdin_open: true
container_name: frontend
ports:
- "3000:3000"
networks:
- mern-app
logging:
driver: "none"
api-server:
image: api-server
restart: always
build: ./backend/
container_name: backend
ports:
- "4000:4000"
networks:
- mern-app
depends_on:
- mongo
mongo:
image: mongo
ports:
- "27017:27017"
networks:
- mern-app
volumes:
- mongo-data:/data/db
networks:
mern-app:
driver: bridge
volumes:
mongo-data:
driver: local