Docker Issue in Spring Boot with Couchbase

I try to run my app as Spring Boot with Couchbase on Docker Here is my docker-compose.yml
version: '3.9'
services:
couchbase:
image: couchbase:latest
container_name: couchbase
ports:
- 8091:8091
- 8092:8092
- 8093:8093
- 8094:8094
- 11210:11210
environment:
COUCHBASE_ADMINISTRATOR_USERNAME: ${COUCHBASE_USERNAME:-Administrator}
COUCHBASE_ADMINISTRATOR_PASSWORD: ${COUCHBASE_PASSWORD:-123456}
COUCHBASE_BUCKET: ${COUCHBASE_BUCKET:-todo_list}
COUCHBASE_AUTO_INDEX: true
volumes:
- ~/couchbase/node1:/opt/couchbase/var
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8091/ui/index.html" ]
interval: 30s
timeout: 10s
retries: 5
networks:
- my_network

todowithcouchbase:
build: .
container_name: todowithcouchbase
ports:
- 2323:2323
depends_on:
couchbase:
condition: service_healthy
environment:
COUCHBASE_BUCKET: ${COUCHBASE_BUCKET:-todo_list}
COUCHBASE_USER: ${COUCHBASE_USERNAME:-Administrator}
COUCHBASE_PASSWORD: ${COUCHBASE_PASSWORD:-123456}
COUCHBASE_PORT: 8091
COUCHBASE_HOST: "couchbase"
networks:
- my_network

networks:
my_network:
driver: bridge
version: '3.9'
services:
couchbase:
image: couchbase:latest
container_name: couchbase
ports:
- 8091:8091
- 8092:8092
- 8093:8093
- 8094:8094
- 11210:11210
environment:
COUCHBASE_ADMINISTRATOR_USERNAME: ${COUCHBASE_USERNAME:-Administrator}
COUCHBASE_ADMINISTRATOR_PASSWORD: ${COUCHBASE_PASSWORD:-123456}
COUCHBASE_BUCKET: ${COUCHBASE_BUCKET:-todo_list}
COUCHBASE_AUTO_INDEX: true
volumes:
- ~/couchbase/node1:/opt/couchbase/var
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8091/ui/index.html" ]
interval: 30s
timeout: 10s
retries: 5
networks:
- my_network

todowithcouchbase:
build: .
container_name: todowithcouchbase
ports:
- 2323:2323
depends_on:
couchbase:
condition: service_healthy
environment:
COUCHBASE_BUCKET: ${COUCHBASE_BUCKET:-todo_list}
COUCHBASE_USER: ${COUCHBASE_USERNAME:-Administrator}
COUCHBASE_PASSWORD: ${COUCHBASE_PASSWORD:-123456}
COUCHBASE_PORT: 8091
COUCHBASE_HOST: "couchbase"
networks:
- my_network

networks:
my_network:
driver: bridge
I already install couchbase in my local computer. I got this error shown below
This is expected if the there is no DNS SRV record associated with the hostname in the connection string. Will now try to bootstrap directly from the given hostname. To suppress this message, specify an IP address instead of a hostname (for example: 127.0.0.1 instead of localhost), specify more than one hostname, or set the `io.enableDnsSrv` client setting to false.
This is expected if the there is no DNS SRV record associated with the hostname in the connection string. Will now try to bootstrap directly from the given hostname. To suppress this message, specify an IP address instead of a hostname (for example: 127.0.0.1 instead of localhost), specify more than one hostname, or set the `io.enableDnsSrv` client setting to false.
How can I fix it?
35 Replies
JavaBot
JavaBot2d ago
This post has been reserved for your question.
Hey @direct_x_34! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st2d ago
Can you show the full error message/stack trace? What is your couchbase connection string?
dan1st
dan1st2d ago
Stack Overflow
Docker Connection Issue for Spring Boot with Couchbase
I want to run my app as Spring Boot with Couchbase in local and on Docker Here is .env shown below COUCHBASE_USERNAME=Administrator COUCHBASE_PASSWORD=123456 COUCHBASE_BUCKET=todo_list COUCHBASE_HO...
direct_x_34
direct_x_34OP2d ago
Yeah, you're right.
dan1st
dan1st2d ago
lol Can you check these two things? And can you show your CouchbaseConfig class? The
This is expected if the there is no DNS SRV record associated with the hostname in the connection string. Will now try to bootstrap directly from the given hostname. To suppress this message, specify an IP address instead of a hostname (for example: 127.0.0.1 instead of localhost), specify more than one hostname, or set the io.enableDnsSrv client setting to false.
is "just" a warning, the error is shown later In what you shared in the SO post, it goes on with
Authentication Failure - Potential causes: invalid credentials or if LDAP is enabled ensure PLAIN SASL mechanism is exclusively used on the PasswordAuthenticator (insecure) or TLS is used (recommended) {"bucket":"todo_list","circuitBreaker":"DISABLED","coreId":"0x1450b18f00000001","remote":"couchbase:11210","status":"UNKNOWN","type":"KV","xerror":{"ref":"b96586b3-65ae-4b33-9d5e-abb73869e6f9"}} {"bucket":"todo_list","circuitBreaker":"DISABLED","coreId":"0x1450b18f00000001","remote":"couchbase:11210","type":"KV"}
so it seems like a credential issue
dan1st
dan1st2d ago
Stack Overflow
couchbase java Authentication Failure issue
I have created json document 'test' inside couchbase bucket 'SAMPLE' which is remote . URL for couchbase is http://testcouch.employee.com:8091/index.html -- IP is 124.10.0.2 UserName for couch:
dan1st
dan1st2d ago
it could also be weird things like quotes in your password in some way: https://stackoverflow.com/a/70210245/10871900
Stack Overflow
Password masking only works for JDBC Connectors
We have set our Kafka Connect to be able to read credentials from a file, instead of giving them directly in connector config. This is how a login part of connector config looks like: "conne...
direct_x_34
direct_x_34OP2d ago
I defined it but nothing changed.
No description
direct_x_34
direct_x_34OP2d ago
I have no issue when I run it in local.
dan1st
dan1st2d ago
So it only happens when deploying it? How are you deploying it? Are you using Docker compose there as well? As I said, the thing about DNS SRV seems to just be a warning
direct_x_34
direct_x_34OP2d ago
I use docker-compose
dan1st
dan1st2d ago
Also for deployment? So both the application and the DB are deployed on the same machine?
direct_x_34
direct_x_34OP2d ago
I try to run it on Docker.
dan1st
dan1st2d ago
With or without Docker compose (where the issue happens) How do you run it on the device where the issue happens? And I recommend checking the authentication/password - can you really authenticate to your production couchbase with the credentials used by the application?
direct_x_34
direct_x_34OP2d ago
As I said before, I can connect Couchbase in my local. The problem is related with not working Spring Boot with Couchbase on Docker.
direct_x_34
direct_x_34OP2d ago
Here is the result when I work with it in local @dan1st
No description
No description
dan1st
dan1st2d ago
Does it work with docker compose on your device?
direct_x_34
direct_x_34OP2d ago
It cannot run on Docker.
dan1st
dan1st2d ago
I'm unsure what you mean with "local" - does it mean "on your computer without Docker compose" or does it mean "on your computer with docker compose"? Do you mean with Docker on your device? And when saying Docker, I assume you are just running docker-compose up, right?
direct_x_34
direct_x_34OP2d ago
I try to do the same thing in Docker.
dan1st
dan1st2d ago
meaning with or without Docker compose?
direct_x_34
direct_x_34OP2d ago
@dan1st With Docker. I have no problem when I work with local. Here are logs
No description
No description
No description
No description
direct_x_34
direct_x_34OP2d ago
I forgot to share this image
No description
dan1st
dan1st2d ago
So the issue occurs when running with Docker on your local machine How are you running it with Docker?
direct_x_34
direct_x_34OPthis hour
No description
dan1st
dan1stthis hour
Can you show the full stack trace? I think it might have an issue with the couchbase password...
direct_x_34
direct_x_34OPthis hour
Here is the full log?
direct_x_34
direct_x_34OPthis hour
I use the same password for Couchbase in both local and Docker part.
dan1st
dan1stthis hour
How are you specifying the password when running locally?
direct_x_34
direct_x_34OP23h ago
COUCHBASE_USERNAME=Administrator COUCHBASE_PASSWORD=123456 COUCHBASE_BUCKET=todo_list COUCHBASE_HOST=127.0.0.1 Here is my .env I used it both in local and Docker @dan1st
dan1st
dan1st23h ago
Do you mean a .env file or environment variables?
JavaBot
JavaBot18h ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
direct_x_34
direct_x_34OP15h ago
@dan1st This is .env file as you can see.
dan1st
dan1st15h ago
What is loading the .env file? You have a .env file locally but not with Docker?
JavaBot
JavaBot10h ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server