Unable to get a shell
I'm trying to do some trouble shooting by getting a shell on the docker container. I've tried everything I can think of, but it seems that /bin/bash or /bin/sh don't exists on the image.
sudo docker run -t -i --entrypoint /bin/bash wrouesnel/postgres_exporter docker: Error response from daemon: Container command '/bin/bash' not found or does not exist..
Is there some other way I can get a shell, so that I can test if it's able to connect to the db? The actual error that I'm trying to solve is this, which I'm assuming is a connectivity issue:
time="2016-05-19T21:21:31Z" level=info msg="Error running query on database: pg_stat_database_conflicts missing "=" after "ubuntu:password@localhost:5432/db" in connection info string"" file="postgres_exporter.go" line=277
time="2016-05-19T21:21:31Z" level=info msg="Error running query on database: pg_stat_bgwriter missing "=" after "ubuntu:password@localhost:5432/db" in connection info string"" file="postgres_exporter.go" line=277
time="2016-05-19T21:21:31Z" level=info msg="Error running query on database: pg_stat_database missing "=" after "ubuntu:password@localhost:5432/db" in connection info string"" file="postgres_exporter.go" line=277
The docker container is just the compiled executable and nothing else. If you need a shell you'd have to derive an image which included gnu tools.
Can you show your actual docker command line?
Sure, the actual docker command I was using was something like this:
sudo docker run --net="host" -e DATA_SOURCE_NAME="ubuntu:password@localhost:5432/db" -p 9113:9113 -d wrouesnel/postgres_exporter
Oh wow, my README.md documentation is atrocious - so the top line I give for a connection string is totally wrong. The correct command would be
sudo docker run --net="host" -e DATA_SOURCE_NAME="postgresql://ubuntu:password@localhost:5432/db" -p 9113:9113 -d wrouesnel/postgres_exporter
You might also need to add ?sslmode=disable to the end of it if you don't have SSL turned on.
Well, that did help. Now I'm getting these types of errors with or without the ?sslmode=disable at the end of the DATA_SOURCE_NAME. Any ideas?
time="2016-05-24T16:50:08Z" level=error msg="Unexpected error parsing column: pg_stat_database_conflicts confl_snapshot
Any suggestion for the above errors? Or a work around. I would rather not install go, but it looks like I may need to.
That's a separate bug with something which has changed with newer versions of postgres. I need to look into why the column types are different.
Related to #8
This should be resolved in the newest docker image on docker hub. docker pull wrouesnel/postgres_exporter:latest will get it for you.