Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose:open sql_exporter.yml: no such file or directory #120

Open
dongdong159 opened this issue Apr 22, 2022 · 1 comment
Open

Comments

@dongdong159
Copy link

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!

@pearupung
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants