docker-compose:open sql_exporter.yml: no such file or directory
dongdong159 opened this issue · comments
I work with docker-compose and how to deal with the issue : Error creating exporter: open sql_exporter.yml: no such file or directory
Thanks!
The setup process was a bit harrowing since I was not familiar with the setup. Figured it out in an hour though.
For CLI run this:
docker run -p "127.0.0.1:9399:9399" -v <absolute path to folder>/sql-exporter-conf/:/home githubfree/sql_exporter --config.file /home/sql_exporter.yml
Found out that to add commands to entrypoint in compose files, you do it like this:
https://stackoverflow.com/questions/37366857/how-to-pass-arguments-to-entrypoint-in-docker-compose-yml
Hence the docker compose file for me looks like this:
sql-exporter:
image: githubfree/sql_exporter
container_name: sql-exporter
hostname: sql-exporter
command: --config.file=/home/sql_exporter.yml
ports:
- 127.0.0.1:9399:9399
volumes:
- sql-exporter-conf:/home
environment:
- POSTGRES_PASSWORD="${PGSQL_PASS:-example}"
- PUID=1000
- PGID=1000
- TZ=Europe/Tallinn
restart: unless-stopped
volumes:
sql-exporter-conf:
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: <absolute path to folder>/sql-exporter-conf'
Sources:
#22
https://dantehranian.wordpress.com/2015/03/25/how-should-i-get-application-configuration-into-my-docker-containers/
Quote:
The command clause does work as @karthik says above.
As a simple example, the following service will have a -inMemory added to its ENTRYPOINT when docker-compose up is run.
services:
local-dynamo:
build: local-dynamo
image: spud/dynamo
command: -inMemory