Grafana in Docker: not all Environment variables are transferred to grafana.ini - docker

I have quite a weird problem and I'm really not sure where it comes from. I'm trying to run a Grafana inside a Docker Container and want to set some grafana.ini values through Environment Variables in the Docker run Command.
docker run -d -v grafana_data:/var/lib/grafana -e "GF_SECURITY_ADMIN_PASSWORD=123456" -e "GF_USERS_DEFAULT_THEME=light" --name=grafana -p 3000:3000 grafana/grafana
The default Theme gets changed as wanted, the admin_password stays the same. I've checked for typos like a million times and could not find one. I've tried with '123456' and without, all with the same result. Is there a reason why I can't change this value?
Thanks in Advance!

https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#admin_password
The password of the default Grafana Admin. Set once on first-run.
Please note the last sentence = it is used only on first run. It won't change admin password if you already changed admin password before and that new password is stored in the database.

Related

Running Elasticsearch with discovery.type=single-node in docker with ES_SETTING_

I'm trying to run ES in docker, with discovery.type=single-node, but my hosting provider prohibits . characters in env variable names.
This is discussed here: https://www.elastic.co/guide/en/elasticsearch/reference/master/docker.html#docker-configuration-methods
With the instructions to convert the setting name as follows:
Change the setting name to uppercase
Prefix it with ES_SETTING_
Escape any underscores (_) by duplicating them
Convert all periods (.) to underscores (_)
So, I think it should become ES_SETTING_DISCOVERY_TYPE=single-node
This works on my laptop:
docker run -e "discovery.type=single-node" -p 9200:9200 elasticsearch:7.14.0
This fails:
docker run -e "ES_SETTING_DISCOVERY_TYPE=single-node" -p 9200:9200 elasticsearch:7.14.0
Any suggestions? ("Get another hosting provider" is valid, but more work than fixing a setting, if it can be fixed).
Apparently my issue was the source is slightly ahead of the docker image.
The change I was trying to use was checked in yesterday and is not present yet in the official docker images.

Set elasticsearch initial password via docker-compose

Can i know, how to set initial password for elasticsearch database using docker-compose
bin/elasticsearch-setup-passwords auto -u "http://192.168.2.120:9200
See this:
The initial password can be set at start up time via the ELASTIC_PASSWORD environment variable:
docker run -e ELASTIC_PASSWORD=MagicWord docker.elastic.co/elasticsearch/elasticsearch-platinum:6.1.4
Also, for newest image (docker.elastic.co/elasticsearch/elasticsearch:7.14.0), the ELASTIC_PASSWORD_FILE environment added mentioned in Configuring Elasticsearch with Docker:
For example, to set the Elasticsearch bootstrap password from a file, you can bind mount the file and set the ELASTIC_PASSWORD_FILE environment variable to the mount location. If you mount the password file to /run/secrets/bootstrapPassword.txt, specify:
-e ELASTIC_PASSWORD_FILE=/run/secrets/bootstrapPassword.txt
So add these environment in docker-compose.yaml I guess could work for you.

docker phpmyadmin - how to add remote server

I can't seem to find the real installation path of my phpmyadmin.
I bash into the phpmyadmin container like this: (I'm on windows)
winpty docker exec -it pma_container_name sh
And then I got in by default in /var/www/html
and I see all the phpmyadmin files there.
I also noticed that there's also a phpmyadmin in /etc/phpmyadmin containing 3 config files, config.inc.php, congif.secret.inc.php, config.user.inc.php
There's also a phpmyadmin in the /usr/src/phpmyadmin containing all the phpmyadmin files.
Now, In /var/www/html - I just:
cp config.sample.inc.php config.inc.php
Then I created a sample file like:
touch phpinfo.php
and I access it in the browser on localhost:8082/phpmyadmin.php
and it totally works.
Now, since I know initially that it was reading my new file, added some config at the bottom:
$i++;
$cfg['Servers'][$i]['host'] = ''; // remote ip address here
$cfg['Servers'][$i]['user'] = '';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
but still nothing happened in the phpmyadmin.
I can't seem to add or choose a remote server.
Any idea why?
I also noticed that the container is in Alpine.
When you run the container set the PMA_HOST environment variable with the host name of your MySQL server. You can also use PMA_USER and PMA_PASSWORD. For example:
docker run --name myadmin -d -e PMA_HOST=mydatabase.com -e PMA_USER=admin -e PMA_PASSWORD=password -p 8080:80 phpmyadmin/phpmyadmin
If you want a custom configuration file, use:
-v /some/local/directory/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
For more information see the Docker image description:
https://hub.docker.com/r/phpmyadmin/phpmyadmin/

Cannot connect Spring Boot application to Docker Mysql container - unknown database

In docker a created network
docker network create mysql-network
Then I create mysql image
docker container run -d -p 3306:3306 --net=mysql-network --name mysql-hibernate -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=test -v hibernate:/var/lib/mysql mysql
When I run docker ps everything seems OK
This is my application.properties
spring.jpa.hibernate.ddl-auto=create
useSSL=false
spring.datasource.url=jdbc:mysql://localhost:3306/test
spring.datasource.username=root
spring.datasource.password=password
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL57Dialect
I also tried
spring.datasource.url=jdbc:mysql://mysql-hibernate:3306/test
But I will always get an error on startup
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'test'
How's that possible that it doesn't know database 'test' ? I specified name in docker like this -e MYSQL_DATABASE=test
What am I missing ?
I know it is bit late but I'll answer anyway so people coming here can benefit ;)
Your configuration overall seems alright. When you get error like this you can add flag param set to true in your application.properties in line where you set datasource url.
So you will come up with something like this:
spring.datasource.url=jdbc:mysql://localhost:3306/test?createDatabaseIfNotExist=true
Hope this helps!

How to modify the password of elasticsearch in docker

I want to modify the password of the container created by the elasticsearch image,I have executed the following orders
setup-passwords auto
but it did't work
enter image description here
unexpected response code [403] from GET http://172.17.0.2:9200/_xpack/security/_authenticate?pretty
Please help me. Thank you.
When using docker it is usually best to configure services via environment variables. To set a password for the elasticsearch service you can run the container using the env variable ELASTIC_PASSWORD:
docker run -e ELASTIC_PASSWORD=`openssl rand -base64 12` -p 9200:9200 --rm --name elastic docker.elastic.co/elasticsearch/elasticsearch-platinum:6.2.4
openssl rand -base64 12 sets a random value for the password

Resources