dockercassandrabitnami

How do I set the password with bitnami/cassandra:4.1 and Docker compose?


I have the following docker-compose file...

version: "3.8"
    
services:
      
  cassandra:
        
    container_name: cassandra
        
    image: bitnami/cassandra:4.1
               
    ports:
          
      - "9042:9042"
        
    environment:
          
      - CASSANDRA_AUTHENTICATOR=PasswordAuthenticator
          
      - CASSANDRA_USER=cassandra
          
      - CASSANDRA_PASSWORD=password

When I run and exec I see that password correctly...

$ echo $CASSANDRA_PASSWORD
password

But when I try to connect I need to use cassandra/cassandra. What am I missing how do I change the password?

I also tried this which causes it to not authenticate at all and this also worked as expected...

 - CASSANDRA_AUTHENTICATOR=AllowAllAuthenticator
 - CASSANDRA_AUTHORIZER=AllowAllAuthorizer

So I know that at least some cassandra variables are working. So I can switch off and on the password check I just can't change the password used.


Solution

  • You missed this env.

    So, this your docker-compose file should be:

    version: "3.8"
        
    services:
          
      cassandra:
            
        container_name: cassandra
            
        image: bitnami/cassandra:4.1
                   
        ports:
              
          - "9042:9042"
            
        environment:
              
          - CASSANDRA_AUTHENTICATOR=PasswordAuthenticator
              
          - CASSANDRA_USER=cassandra
     
          - CASSANDRA_PASSWORD_SEEDER=yes         
          - CASSANDRA_PASSWORD=password