I'm using docker-compose to create a Docker network of containers with InfluxDB, a python script and Grafana to harvest and visualize response codes, query times & other stats of different websites.
I am using Grafana image 7.3.0 with a volume,
I have modified the paths environment variables so I'll have to use only one volume to save all the data.
When I start the Grafana container it logs:
GF_PATHS_CONFIG='/etc/grafana/grafana.ini' is not readable.
GF_PATHS_DATA='/etc/grafana/data' is not writable.
GF_PATHS_HOME='/etc/grafana/home' is not readable.
You may have issues with file permissions, more information here: http://docs.grafana.org/installation/docker/#migration-from-a-previous-version-of-the-
docker-container-to-5-1-or-later
mkdir: can't create directory '/etc/grafana/plugins': Permission denied
But here is the thing, I'm not migrating from below 5.1 I'm not even migrating at all!
So I tried to follow their instruction to change permissions of files but it did not worked.
I tried to set the user id in the docker-compose but it did not help.
(as-said in the docs 472 == post 5.1, 104 == pre 5.1 but both did not worked)
I can't even change permissions manually (which is not a satisfying solution btw) because the container is crashing.
I normally don't ask questions because they already have answers but I've seen no one with this trouble using 7.3.0 so I guess it's my time to shine Haha.
Here is my docker-compose.yml (only the grafana part)
version: '3.3'
services:
grafana:
image: grafana/grafana:7.3.0
ports:
- '3000:3000'
volumes:
- './grafana:/etc/grafana'
networks:
- db-to-grafana
depends_on:
- db
- influxdb_cli
environment:
- GF_PATHS_CONFIG=/etc/grafana/grafana.ini
- GF_PATHS_DATA=/etc/grafana/data
- GF_PATHS_HOME=/etc/grafana/home
- GF_PATHS_LOGS=/etc/grafana/logs
- GF_PATHS_PLUGINS=/etc/grafana/plugins
- GF_PATHS_PROVISIONING=/etc/grafana/provisioning
user: "472"
Thank you very much for your potential help!
Edit : I've been wondering if there is a grafana user in latest version (8.0), I think that build a home dir for grafana using a Dockerfile could be the solution I just need to find that user.
I'm here to close this subject.
So this was kind of a noob mistake but I could not have known.
The problem came from the fact that Grafana won't chown and chmod the volume folder. The error does not occures but it won't work because it does not save the data.
The solution was to remove the env variables and changing permissions of the local './grafana' folder wich contained the volume.
So I did
chown -R <personal local user> /path/to/local/volume/folder && \
chmod -R 777 /path/to/local/volume/folder
And now it works normally
Here is my new docker compose
docker-compose.yml
grafana:
image: grafana/grafana
ports:
- '3000:3000'
volumes:
- './grafana:/var/lib/grafana'
networks:
- db-to-grafana
depends_on:
- db
- influxdb_cli
Thanks everybody four your help !
Just replace your user's id that you will get on the following command:
$ id -u
Im running 'id -u' in my terminal and getting '1000'. SO, I replaced user: "xxxx" to user: "1000" in docker-compose.yml
version: '3.3'
services:
grafana:
image: grafana/grafana:7.3.0
ports:
- '3000:3000'
volumes:
- './grafana:/etc/grafana'
networks:
- db-to-grafana
depends_on:
- db
- influxdb_cli
environment:
- GF_PATHS_CONFIG=/etc/grafana/grafana.ini
- GF_PATHS_DATA=/etc/grafana/data
- GF_PATHS_HOME=/etc/grafana/home
- GF_PATHS_LOGS=/etc/grafana/logs
- GF_PATHS_PLUGINS=/etc/grafana/plugins
- GF_PATHS_PROVISIONING=/etc/grafana/provisioning
user: "1000"
Related
I am new to parse-server and to docker world, and I think that either I did not understand this properly or it is not working. Sorry if this will come as a stupid question.
So from docker documentation, I understand that if I want to bind a folder location to my docker location I have to do something like this.
volumes:
- /host/path/to/folder:/docker/path/to/folder
But the thing that I am missing is that after I create all my docker and I bind the volume paths like this when I am adding new rows into my MongoDB database I will have nothing saved into those folders. Can anyone explain to me what I am doing wrong?
Basically, I am trying to save all my changes from MongoDB and the server into a local folder.
My docker-compose:
version: '3.9'
services:
database:
image: mongo:6.0.1
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin
volumes:
- ./data/mongodb:/data/mongodb
server:
restart: always
image: parseplatform/parse-server:5.2.5
ports:
- 1337:1337
environment:
- PARSE_SERVER_APPLICATION_ID=COOK_APP
- PARSE_SERVER_MASTER_KEY=MASTER_KEY_1
- PARSE_SERVER_DATABASE_URI=mongodb://admin:admin#mongo/parse_server?authSource=admin
- PARSE_ENABLE_CLOUD_CODE=yes
- PARSE_SERVER_URL=http://10.0.2.2:1337/parse
links:
- database:mongo
volumes:
- ./data/server:/data/server
dashboard:
image: parseplatform/parse-dashboard:4.1.4
ports:
- "4040:4040"
depends_on:
- server
environment:
- PARSE_DASHBOARD_APP_ID=COOK_APP
- PARSE_DASHBOARD_APP_NAME=COOK_APP
- PARSE_DASHBOARD_MASTER_KEY=MASTER_KEY_1
- PARSE_DASHBOARD_USER_ID=admin
- PARSE_DASHBOARD_USER_PASSWORD=admin
- PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=true
- PARSE_DASHBOARD_SERVER_URL=http://localhost:1337/parse
volumes:
- ./data/dashboard:/data/dashboard
UPDATE:
After I've checked your response regarding ./data/mongodb:/data/db is working just partially. In a sense that I have these 2 cases.
If I will use it like this data/mongodb:/data/db without that . in order to save that data into my root directory, then everything is working fine. But I would like to save it in my local directory where all the projects will be.
So if I am doing as you said ./data/mongodb:/data/db in order to save it into the local directory my MongoDB is not going to star and I will get this error message for some unknown reason.
{"t":{"$date":"2022-09-07T16:05:52.523+00:00"},"s":"W", "c":"STORAGE", "id":22347, "ctx":"initandlisten","msg":"Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade."} 2022-09-07T16:05:52.524152876Z {"t":{"$date":"2022-09-07T16:05:52.523+00:00"},"s":"F", "c":"STORAGE", "id":28595, "ctx":"initandlisten","msg":"Terminating.","attr":{"reason":"1: Operation not permitted"}} 2022-09-07T16:05:52.524168870Z {"t":{"$date":"2022-09-07T16:05:52.523+00:00"},"s":"F", "c":"ASSERT", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":28595,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp","line":702}} 2022-09-07T16:05:52.524183328Z {"t":{"$date":"2022-09-07T16:05:52.523+00:00"},"s":"F", "c":"ASSERT", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
Any idea why?
If you check the "where to store data" section of the mongo image documentation (https://hub.docker.com/_/mongo), you will see that, inside the container, mongo actually saves the data in the folder /data/db (and not /data/mongodb). So you will have to bind it:
volumes:
- ./data/mongodb:/data/db
I am new to docker and I am building a simple dashboard app with Loki and Grafana.
I am trying to change the Grafana setup file in the Grafana container, however, it says "Permission denied". I tried mkdir test in the container at multiple locations and they are all permission denied, so I know its a permission issue. For my entire repository, I have 4 separate containers. All other containers do not get permission denied, only the Grafana container. Furthermore, my old Ubuntu VM was corrupted, but the old VM also did not get permission denied, so I am not sure why the new one is.
I have tried running:
sudo chmod -R a+rwx repo
to provide permissions to everything. I checked all the volumes permissions by right-clicking them, and they are all "Create and delete files" for Owner, Group and Others.
On the docker container, I ran a permissions check and got:
However, the other containers have similar permissions.
I also ran id on the container. For the container with no permissions, I got:
for the one that does not work.
The ones that do work return
The entire docker-compose code can be found here:
version: "3"
networks:
bypass:
services:
loki:
image: grafana/loki:2.4.0
volumes:
- ./admin/config:/mnt/config
- ./data/loki:/mnt/loki
ports:
- "3100:3100"
command: -config.file=/mnt/config/loki-config.yaml
restart: unless-stopped
networks:
- bypass
promtail:
image: grafana/promtail:2.4.0
volumes:
- ./data/raw:/mnt/raw
- ./data/log:/mnt/log
- ./admin/config:/mnt/config
command: -config.file=/mnt/config/promtail-config.yaml
restart: unless-stopped
networks:
- bypass
bypass:
image: bypass:latest
ports:
- "8080:8080"
volumes:
- ./data/raw:/mnt/raw
- ./data/log:/mnt/log
- ./admin/config:/mnt/config
- ./data/template:/mnt/template
networks:
- bypass
grafana:
image: grafana/grafana:8.2.5
user: "1000"
volumes:
- ./data/grafana:/var/lib/grafana
- ./data/log:/var/lib/temp_data
restart: unless-stopped
ports:
- "3000:3000"
networks:
- bypass
The issue was under user. I tried specifying
user: "1000"
in the grafana docker-compose because when running id on my local machine, it says that the UID for the user and group are both 1000. Despite this, I had to change the user to
user: "0"
to replicate what I was seeing on the containers of my other services and it worked!
When running Corda in docker with external Postgres DB configurations, I get insufficient privileges to access error.
Note:
Corda: 4.6 Postgresql: 9.6
Docker engine 20.10.6
Docker-compose: docker-compose version 1.29.1, build c34c88b2
docker-compose.yml file:
version: '3.3'
services:
partyadb:
hostname: partyadb
container_name: partyadb
image: "postgres:9.6"
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: partyadb
ports:
- 5432
partya:
hostname: partya
# image: corda/corda-zulu-java1.8-4.7:RELEASE
image: corda/corda-zulu-java1.8-4.6:latest
container_name: partya
ports:
- 10006
- 2223
command: /bin/bash -c "java -jar /opt/corda/bin/corda.jar run-migration-scripts -f /etc/corda/node.conf --core-schemas --app-schemas && /opt/corda/bin/run-corda"
volumes:
- ./partya/node.conf:/etc/corda/node.conf:ro
- ./partya/certificates:/opt/corda/certificates:ro
- ./partya/persistence.mv.db:/opt/corda/persistence/persistence.mv.db:rw
- ./partya/persistence.trace.db:/opt/corda/persistence/persistence.trace.db:rw
# - ./partya/logs:/opt/corda/logs:rw
- ./shared/additional-node-infos:/opt/corda/additional-node-infos:rw
- ./shared/cordapps:/opt/corda/cordapps:rw
- ./shared/drivers:/opt/corda/drivers:ro
- ./shared/network-parameters:/opt/corda/network-parameters:rw
environment:
- ACCEPT_LICENSE=${ACCEPT_LICENSE}
depends_on:
- partyadb
Error:
[ERROR] 12:41:24+0000 [main] internal.NodeStartupLogging. - Exception during node startup. Corda started with insufficient privileges to access /opt/corda/additional-node-infos/nodeInfo-5B........................................47D
The corda/corda-zulu-java1.8-4.6:latest image runs under the user corda, not root. This user has user id 1000, and also is in a group called corda, also with gid 1000:
corda#5bb6f196a682:~$ id -u corda
1000
corda#5bb6f196a682:~$ groups corda
corda : corda
corda#5bb6f196a682:~$ id -G corda
1000
The problem here seems to be that the file you are mounting into the docker container (./shared/additional-node-infos/nodeInfo-5B) does not have permissions setup in such a way as to allow this user to access it. I'm assuming the user needs read and write access. A very simple fix would be to give other read and write access to this file:
$ chmod o+rw ./shared/additional-node-infos/nodeInfo-5B
There are plenty of other ways to manage this kind of permissions issue in docker, but remember that the permissions are based on uid/gid which usually do not map nicely from your host machine into the docker container.
So the error itself describes that it's a permission problem.
I don't know if you crafted this dockerfile yourself, you may want to take a look at generating them with the dockerform task (https://docs.corda.net/docs/corda-os/4.8/generating-a-node.html#use-cordform-and-dockerform-to-create-a-set-of-local-nodes-automatically)
This permission problem could be that you're setting only read / write within the container:
- ./shared/additional-node-infos:/opt/corda/additional-node-infos:rw
or it could be that you need to change the permissions on the shared folder. Try changing the permissions of shared to 777 and see if that works, then restrict your way back down to permissions you're comfortable with.
I just configure the image to be run as root. This works but may not be safe. Simply add
services:
cordaNode:
user: root
to the service configuration.
Ref: How to configure docker-compose.yml to up a container as root
more-question-detail
so, where can I find the data of ghost-blog?
If we take a look at the description for ghost image on dockerhub, you can find this:
This Docker image for Ghost uses SQLite. There is nothing special to configure.
Moreover, if we open the latest docker file (which at the moment is 2.9.1, 2.9, 2, latest (2/debian/Dockerfile) ), whe can see the following line:
gosu node yarn add "sqlite3#$sqlite3Version" --force --build-from-source; \
This installs an sqlite database inside the ghost container. This database will contain all your posts, users, etc.
same image ghost2.9
the guide from docker-ghost
run with: docker-compose -f stack.yml up
then I can get data from mysql docker container.
why cannot by this way question-detail, which confused me~ /(ćoć)/~~
version: '3.1'
services:
ghost:
image: ghost:2.9
ports:
- 2368:2368
volumes:
- $PWD/content:/var/lib/ghost/content
environment:
# see https://docs.ghost.org/docs/config#section-running-ghost-with-config-env-variables
database__client: mysql
database__connection__host: localhost
database__connection__user: root
database__connection__password: anywhere
database__connection__database: ghost
db:
image: mysql:5.7
volumes:
- $PWD/data:/var/lib/mysql
ports:
- 3307:3306
environment:
MYSQL_ROOT_PASSWORD: anywhere
A few days ago, I installed docker on my new laptop. I've used docker for a while and know the basics pretty well. Yet, for some reason I keep bumping into the same problem and I hope someone here can help me.
After installing the Docker Toolbox on my Windows 10 Home laptop, I tried to run some images that I've created using a docker-compose.yml. Since my user directory on windows has my exact name in it (C:/Users/Nick van der Meij) and that name contains spaces, I added an extra shared folder from C:/code to /mnt/code on the Docker Host (this works). I've used this guide to do so
However, when I try to run my docker-compose.yml (included below), I get the following error:
ERROR: for php Cannot create container for service php: create \mnt\code\basic_php\api: "\\mnt\\code\\basic_php\\api" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed
[31mERROR[0m: Encountered errors while bringing up the project.
As far as I see it, everything seems to be correct according to the official docker docs about volumes. I've spend many hours trying to fix this and tried out multiple "formats" for the volumes tag, yet without any success.
Does anyone know what the problem might be?
Thanks in Advance!
docker-compose.yml
version: '2'
services:
mysql:
image: mysql:5.7
ports:
- 3306
volumes:
- /var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_DATABASE: database
nginx:
image: nginx:1.10.2
ports:
- 80:80
- 443:443
restart: always
volumes:
- /mnt/code/basic_php/nginx/conf:/etc/nginx/conf.d
- /mnt/code/basic_php/api:/code/api
- /mnt/code/basic_php/nginx:/code/nginx
links:
- php
- site
depends_on:
- php
- site
php:
build: php
expose:
- 9000
restart: always
volumes:
- /mnt/code/basic_php/php/conf/php.ini:/usr/local/etc/php/conf.d/custom.ini
- /mnt/code/basic_php/api:/code/api
links:
- mysql
site:
restart: always
build: site
ports:
- 80
container_name: site
After a few hours searching the web, I finally found what i was looking for. Like Wolfgang Blessen said in the comments below my question, the problem was indeed a Windows Path problem.
If you dont want docker to automatically convert paths windows to unix, you need to add the COMPOSE_CONVERT_WINDOWS_PATHS environment variable with a value of 0 like explained here: link
Use git bash and do
export COMPOSE_CONVERT_WINDOWS_PATHS=1
then execute
docker-compose up -d
Or simply use double backslash
winpty docker run -it -v C:\\path\\to\\folder:/mount