How to generate graphana container correctly?

Asked

Viewed 388 times

1

I installed the graphite container via Docker as follows :

docker run -d --name=grafana \
--restart always \
-p 5000:3000 \
-e "GF_SERVER_PROTOCOL=http" \
-e "GF_SERVER_ROOT_URL=http://meuIP" \
-e "GF_SERVER_HTTP_PORT=3000" \
-v /docker/grafana/data:/var/lib/grafana \
grafana/grafana

But when I try to access it will not because it is not running on the IP I want ( meuIP) and yes no 0.0.0.0 as shown below :

CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS                    NAMES
2c7246e98d99        grafana/grafana     "/run.sh"           About a minute ago   Up 4 seconds        0.0.0.0:5000->3000/tcp   grafana

In this case how do I route and access it by typing http://meuIP:5000 in the browser ?

EDITED :

I’m using the Centos7.

The Docker version is :

Client:
 Version:      17.05.0-ce
 API version:  1.29
 Go version:   go1.7.5
 Git commit:   89658be
 Built:        Thu May  4 22:06:25 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.05.0-ce
 API version:  1.29 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   89658be
 Built:        Thu May  4 22:06:25 2017
 OS/Arch:      linux/amd64
 Experimental: false

Edited 2 :

The problem is that overnight the container gets status Exited (1) seconds after I spin.

If I do it like this it spins and I can access :

docker run \
  -d \
  -p 5200:3000 \
  grafana/grafana

But I want to install the plugin from Zabbix too. Ai if I do so it exits after 10 seconds:

docker run -d \
-p 5100:3000 \
-e "GF_INSTALL_PLUGINS=alexanderzobnin-zabbix-app" \
grafana/grafana

I also want to redirect the container data to a specific folder so if something goes wrong I can recover .

If I do it like this, it turns him on:

docker run \
  -d \
  -p 5200:3000 \
   -v /docker/grafana/data:/var/lib/grafana \
  grafana/grafana

But I wanted to do it this way :

docker run -d \
-p 5100:3000 \
-e "GF_INSTALL_PLUGINS=alexanderzobnin-zabbix-app" \
-v /docker/grafana/data:/var/lib/grafana \
grafana/grafana

Does anyone know why the container is being canceled when I try to install the plugin or redirect the output ?

  • Do a test like this: docker run -d -p 3000:3000 grafana/grafana. After that tries to access http://localhost:3000 and tell me if you can access.

  • @Tuxpilgrim, yes I tried but it also doesn’t work.

  • On Linux. More precisely on Centos 7.

  • I edited the question to add more information.

  • I edited the question again.

  • I suggest you edit the title of the question, the problem apparently no longer relates to accessing the address of container.

  • Edited title.

Show 2 more comments

1 answer

1


In view of your scenario, I would recommend creating a custom image with the plugin(s) you need, make it easy instead of running this large command whenever it is startar your container.

Configuring the Dockerfile

In the repository of graphana has a directory custom/with a Dockerfile to customize, just do the clone and use.

Building the image

Inside the cloned directory (grafana-docker/custom/), construct the new image by passing the parameter:

  • the version of the graph image used as a base, in the variable GRAFANA_VERSION
  • and the plugins(s) you want to install in the variable GF_INSTALL_PLUGINS

Something like that:

docker build -t grafana:atual_com_plugins \
  --build-arg "GRAFANA_VERSION=latest" \
  --build-arg "GF_INSTALL_PLUGINS=alexanderzobnin-zabbix-app" .

Tip¹: Instead of using the tag latest always use the latest stable version, in case the version v5.1.0.

Initiating the container

With your successfully built image, you can start normally:

docker run \
  -d \
  -p 5200:3000 \
  --name=grafana \
   -v /docker/grafana/data:/var/lib/grafana \
  grafana:atual_com_plugins

All this information is available in the documentation of installation with Docker.

Obs: if it still doesn’t work, check whether the plugin is ok or if it is no problem with the versions of the graphana are no problem.

EDIT: As quoted by @Beto, if you want to persist the data using volume, you need to give permission in the directory where the data will be stored.

  • 1

    It worked. It had to generate the pugins with the graphana dockerfile itself. You also have to give permission in the host folder that will save the data from the graphana container to the container to run, if you want to do so.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.