I’ve a basic spring boot and couchbase app. I want to dockerized it but when I dockerized both of my server(spring + db) I can’t connect couchbase from spring boot. I guess this is caused by localhost
My Couchbase Config on Spring
@Configuration
public class CouchbaseConfiguration extends AbstractCouchbaseConfiguration {
@Override
public String getConnectionString() {
return "couchbase://127.0.0.1";
}
@Override
public String getUserName() {
return "Administrator";
}
@Override
public String getPassword() {
return "password";
}
@Override
public String getBucketName() {
return "default";
}
@Override
protected boolean autoIndexCreation() {
return true;
}
}
I now, when we use the dockerized app, don’t use localhost(127.0.0.1) but I can’t react to couchbase with hostname
My Docker-compose file
version: '3.0'
services:
couchbase:
build: ./couchbase
container_name: couchbase
volumes:
- ~/couchbase/node1:/opt/couchbase/var
ports:
- 8091:8091
- 8092:8092
- 8093:8093
- 11210:11210
todo_server:
build: ./todo-backend
container_name: todo_server
depends_on:
- couchbase
ports:
- 8080:8080
How can I to couchbase with http://db:8091
?