Provide an example of docker-compose.yml
oijkn opened this issue · 2 comments
oijkn commented
I am trying to configure the docker-compose.yml
file but it doesn't seem to work. On the other hand by making a docker run
command I do not have any problem.
What works :
docker run -d -p 9469:9469/tcp -v /data/script_exporter/examples:/opt/examples -config.file /opt/examples/config.yaml -web.listen-address ":9469" ricoberger/script_exporter:v2.4.0
Script Exporter
- version: v2.4.0
- branch: HEAD
- revision: 5eb48ef
- go version: go1.17.1
- build user: root
- build date: 20210915-14:23:11
What doesn't work :
version: '3'
services:
script_exporter:
command:
- '-config.file=/opt/examples/config.yaml'
- '-web.listen-address=":9469"'
container_name: 'script_exporter'
image: 'ricoberger/script_exporter:v2.4.0'
ports:
- '9469:9469'
volumes:
- '/data/script_exporter/examples:/opt/examples'
Below is the log when I run the docker-compose :
Building with native build. Learn about native build in Compose here: https://docs.docker.com/go/compose-native-build/
Recreating script_exporter ... done
Attaching to script_exporter
script_exporter | Starting server (version=v2.4.0, branch=HEAD, revision=5eb48ef1b53c11f98a4a6609667389e5c7140a42)
script_exporter | Build context (go=go1.17.1, user=root, date=20210915-14:23:11)
script_exporter | script_exporter listening on ":9469"
script_exporter | 2021/09/29 20:17:17 listen tcp: address tcp/9469": unknown port
script_exporter exited with code 1
As on your documentation nothing is specified about the parameters for the docker-compose, could you tell me how to make your docker work with a docker-compose, please ? Thanks
oijkn commented
A colleague found the solution, we must remove the double quotes ":9469"
version: '3'
services:
script_exporter:
command:
- '-config.file=/opt/examples/config.yaml'
- '-web.listen-address=:9469'
container_name: 'script_exporter'
image: 'ricoberger/script_exporter:v2.4.0'
ports:
- '9469:9469'
volumes:
- '/data/script_exporter/examples:/opt/examples'
ricoberger commented
Hi @oijkn, thanks for sharing your solution.
I added a Docker Compose file, based on your solution to the repository.