Grafana Docker deployment and construction (the most complete in history)

Introduction to Grafana

Grafana is a very useful data visualization platform, which is often used to display monitoring data. The underlying data source can support influxDb, graphite, elasticSeach, etc.

https://github.com/grafana/grafana

1. Install docker

(1) Windows Docker installation

Docker is not a general purpose container tool, it relies on an existing and running Linux kernel environment.

Docker essentially creates an isolated file environment under the already running Linux, so its execution efficiency is almost equal to that of the deployed Linux host.

Therefore, Docker must be deployed on a system with a Linux kernel. If other systems want to deploy Docker, they must install a virtual Linux environment.

The way to deploy Docker on Windows is to install a virtual machine first, and run Docker in the virtual machine where the Linux system is installed.

Win10 system

Docker Desktop is the official installation method of Docker on Windows 10 and macOS operating systems. This method still belongs to the method of first installing Linux in a virtual machine and then installing Docker.

Docker Desktop official download link:  Install on Windows | Docker Documentation

Note: This method is only available for Professional, Enterprise, Education and some Home editions of the Windows 10 operating system!

Install Hyper-V

Hyper-V is a virtual machine developed by Microsoft, similar to VMWare or VirtualBox, only for Windows 10. This is the virtual machine used by Docker Desktop for Windows.

However, once this virtual machine is enabled, QEMU, VirtualBox or VMWare Workstation 15 and below will not work! If you must use another virtual machine on your computer (such as an emulator to develop Android applications), please do not use Hyper-V!

Enable Hyper-V

Programs and Features

Turn Windows features on or off

Select Hyper-V

You can also enable Hyper-V by command, please right-click the start menu and run PowerShell as an administrator, execute the following command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

Install Docker Desktop for Windows

Click  Get started with Docker Desktop and download the Windows version. If you are not logged in, you will be asked to register and log in:

run the installer

Double-click the downloaded Docker for Windows Installer installation file, click Next all the way, and click Finish to complete the installation.

After the installation is complete, Docker will start automatically. A little whale icon will appear on the notification bar

, which indicates that Docker is running.

Three icons will also appear on the side of the table, as shown in the following figure:

We can execute docker version on the command line to view the version number, and docker run hello-world to load the test image for testing.

If it doesn't start, you can search for Docker in Windows to start:

After startup, you can also see the little whale icon on the notification bar:

If you encounter errors caused by WSL 2 during startup, please install  WSL 2 .

After installation, you can open PowerShell and run the following command to check whether the operation is successful:

docker run hello-world

The following message should appear after a successful run:


win7, win8 system

Win7, win8, etc. need to use docker toolbox to install, and domestic users can use the image of Alibaba Cloud to download, download address: docker-toolbox-windows-docker-toolbox installation package download_Open Source Mirror Station-Alibaba Cloud

The installation is relatively simple, double-click to run, click Next, you can check the components you need:

docker toolbox is a tool set, which mainly includes the following contents:

  • Docker CLI - Client to run docker engine to create images and containers.
  • Docker Machine - Lets you run docker engine commands from the Windows command line.
  • Docker Compose - Used to run docker-compose commands.
  • Kitematic - This is the GUI version of Docker.
  • Docker QuickStart shell - This is a command line environment with Docker already configured.
  • Oracle VM Virtualbox - virtual machine.

After the download is complete, click Install directly. After the installation is successful, three icons will appear on the side of the table, as shown in the figure below:

Click the Docker QuickStart icon to launch the Docker Toolbox terminal.

If the system displays the User Account Control window to run VirtualBox to modify your computer, select Yes.

$ sign where you can enter the following command to execute.

$ docker run hello-world
 Unable to find image 'hello-world:latest' locally
 Pulling repository hello-world
 91c95931e552: Download complete
 a8219747be10: Download complete
 Status: Downloaded newer image for hello-world:latest
 Hello from Docker.
 This message shows that your installation appears to be working correctly.

 To generate this message, Docker took the following steps:
  1. The Docker Engine CLI client contacted the Docker Engine daemon.
  2. The Docker Engine daemon pulled the "hello-world" image from the Docker Hub.
     (Assuming it was not already locally available.)
  3. The Docker Engine daemon created a new container from that image which runs the
     executable that produces the output you are currently reading.
  4. The Docker Engine daemon streamed that output to the Docker Engine CLI client, which sent it
     to your terminal.

 To try something more ambitious, you can run an Ubuntu container with:
  $ docker run -it ubuntu bash

 For more examples and ideas, visit:
  https://docs.docker.com/userguide/

(2) MacOS Docker installation

Install using Homebrew

macOS We can use Homebrew to install Docker.

Homebrew's Cask already supports Docker for Mac, so you can easily use Homebrew Cask to install:

$ brew install --cask --appdir=/Applications docker
==> Creating Caskroom at /usr/local/Caskroom
==> We'll set permissions properly so we won't need sudo in the future
Password: # Enter macOS password
==> Satisfying dependencies
==> Downloading https://download.docker.com/mac/stable/21090/Docker.dmg
######################################################################## 100.0%
==> Verifying checksum for Cask docker
==> Installing Cask docker
==> Moving App 'Docker.app' to '/Applications/Docker.app'.
🍺  docker was successfully installed!

After loading the Docker app, click Next, you may be asked for your macOS login password, you can enter it. After that, a docker running prompt window will pop up, and there is also a little whale icon on the status bar (

)。


Download and install manually

If manual download is required, click the link below to download  Install Docker Desktop on Mac  .

Like other macOS software, the installation is also very simple, double-click the downloaded .dmg file, and then drag the whale icon to the Application folder.

Find the Docker icon from Applications and hit run. You may be asked for the macOS login password, just enter it.

Clicking on the whale icon in the top status bar brings up the actions menu.

Click the icon for the first time, you may see the interface of successful installation, click "Got it!" to close this window.

After starting the terminal, you can check the installed Docker version by command.

$ docker --version
Docker version 17.09.1-ce, build 19e2cf6

mirror acceleration

In view of the domestic network problem, the subsequent pull of the Docker image is very slow. We may need to configure an accelerator to solve it. I use the image address of NetEase: http://hub-mirror.c.163.com.

On the taskbar, click the Docker for mac application icon -> Perferences... -> Daemon -> Registry mirrors. Just fill in the accelerator address in the list. After the modification is complete, click the Apply & Restart button, and Docker will restart and apply the configured mirror address.

After that, we can check whether the configuration is successful through docker info.

$ docker info
...
Registry Mirrors:
 http://hub-mirror.c.163.com
Live Restore Enabled: false

(3) CentOS Docker installation

Docker supports the following 64-bit CentOS versions:

  • CentOS 7
  • CentOS 8
  • higher version...

Automatic installation using the official installation script

The installation command is as follows:

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

You can also use the domestic daocloud one-click installation command:

curl -sSL https://get.daocloud.io/docker | sh

manual installation

uninstall old version

Older versions of Docker were called docker or docker-engine. If these programs are installed, uninstall them and their associated dependencies.

$ sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

Install Docker Engine-Community

Install using Docker repository

Before installing Docker Engine-Community for the first time on a new host, you need to set up a Docker repository. After that, you can install and update Docker from the repository.

set warehouse

Install the required packages. yum-utils provides yum-config-manager, and the device mapper storage driver requires device-mapper-persistent-data and lvm2.

$ sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

Use the following commands to set up a stable repository.

Use the official source address (slower)

$ sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

Some domestic source addresses can be selected:

Ali Cloud

$ sudo yum-config-manager \
    --add-repo \
    http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

Source from Tsinghua University

$ sudo yum-config-manager \
    --add-repo \
    https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo

Install Docker Engine-Community

Install the latest version of Docker Engine-Community and containerd, or go to the next step to install a specific version:

$ sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin

Select Yes if prompted to accept the GPG key.

Have multiple Docker repositories?

If multiple Docker repositories are enabled, installing or updating without specifying a version in a yum install or yum update command will always install the highest version, which may not be suitable for your stability needs.

Docker is not started by default after installation. And the docker user group has been created, but there are no users under this user group.

To install a specific version of Docker Engine-Community, list the available versions in the repository, then select and install:

1. List and sort the versions available in your repository. This example sorts the results by version number (highest to lowest).

$ yum list docker-ce --showduplicates | sort -r

docker-ce.x86_64  3:18.09.1-3.el7                     docker-ce-stable
docker-ce.x86_64  3:18.09.0-3.el7                     docker-ce-stable
docker-ce.x86_64  18.06.1.ce-3.el7                    docker-ce-stable
docker-ce.x86_64  18.06.0.ce-3.el7                    docker-ce-stable

2. Install a specific version by its full package name, which is the package name (docker-ce) plus the version string (second column), from the first colon (:) to the first hyphens and separate them with a hyphen (-). For example: docker-ce-18.09.1.

$ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io

Start Docker.

$ sudo systemctl start docker

Verify that Docker Engine-Community is installed correctly by running the hello-world image.

$ sudo docker run hello-world

uninstall docker

Remove the installation package:

yum remove docker-ce

Delete images, containers, configuration files, etc.:

rm -rf /var/lib/docker

2.docker installs grafana

docker run -d -p 3000:3000 grafana/grafana-enterprise

2. start

docker ps -a
docker stop 容器ID 
docker star 容器ID 
docker rm 容器ID 
docker rmi 镜像名称

3. Login

http://127.0.0.1:3000/

Account: admin

Password: 123456

Remarks: The first login will guide you to change the initial password

Guess you like

Origin blog.csdn.net/u013302168/article/details/128199952