grafana docker 安裝使用

2021-08-08 14:21:42 字數 3971 閱讀 4611

1.配置yum源

vim /etc/yum.repos

.d/docker.repo 新增

[dockerrepo]

name=docker repository

baseurl=

.org/repo/main/centos/7 enabled=1 gpgcheck=1 gpgkey=

.org/gpg

2.使用yum命令安裝docker

yum install docker
3.啟動測試docker

service docker start

service docker status

redirecting to /bin/systemctl status docker.service

loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)

active: active (running) since thu 2017-09-21 16:49:14 cst; 7s ago

docs:

main pid: 57748 (dockerd-current)

cgroup: /system.slice/docker.service

├─57748 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgr...

└─57759 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-inte...

sep 21 16:49:13 yq-hadoop-184201 dockerd-current[57748]: time="2017-09-21t16:49:13.564336376+08:00" level=warning msg="docker could not enable selinux on... system"

sep 21 16:49:13 yq-hadoop-184201 dockerd-current[57748]: time="2017-09-21t16:49:13.718614700+08:00" level=info msg="graph migration to content-addressabi...seconds"

sep 21 16:49:13 yq-hadoop-184201 dockerd-current[57748]: time="2017-09-21t16:49:13.719167634+08:00" level=info msg="loading containers: start."

sep 21 16:49:13 yq-hadoop-184201 dockerd-current[57748]: time="

2017-09-21t16:49:13.786309409+08:00

" level=info msg="firewalld running: false

"sep 21 16:49:14 yq-hadoop-184201 dockerd-current[57748]: time="

2017-09-21t16:49:14.053544531+08:00

" level=info msg="

default bridge (docker0) is assigned ...address"

sep 21 16:49:14 yq-hadoop-184201 dockerd-current[57748]: time="

2017-09-21t16:49:14.313472144+08:00

" level=info msg="loading containers: done."

sep 21 16:49:14 yq-hadoop-184201 dockerd-current[57748]: time="

2017-09-21t16:49:14.313593050+08:00

" level=info msg="daemon has completed initialization"

sep 21 16:49:14 yq-hadoop-184201 dockerd-current[57748]: time="

2017-09-21t16:49:14.313615684+08:00

" level=info msg="docker daemon" commit="

0fdc778/1.12

.6...n=1.12

.6sep 21

16:49:14 yq-hadoop-184201 dockerd-current[57748]: time="2017-09-21t16:49:14.320056675+08:00"

level=info msg="api listen on /var/run/docker.sock"

sep 21

docker run hello-world

測試docker 安裝是否有問題

docker version #檢視版本

另一種方式

建立持久化volume

docker run -d

-v /var/lib/grafana --name grafana-storage busybox:latest

從volume獲得資料啟動

docker run \

-d \

-p 3000

:3000 \

--name=grafana \

--volumes-from grafana-storage \

grafana/grafana

5.檢視映象

# docker images

repository tag image id created size

docker.io/grafana/grafana latest e4accc9ea909 6 days ago 302.8 mb

docker.io/hello-world latest 05a3bd381fc2 8 days ago 1.84 kb

6.啟動docker

docker run -d

-i-t e4accc9ea909 -p

3000:3000 /bin/bash

7.如果進入docker容器,比較常見的做法有

使用docker attach

# docker ps

container

idimage

command

created

status

ports

names

7d0a68fe4562 grafana/grafana "/run.sh"

22 minutes ago up

22 minutes 0.0

.0.0:3000->3000/tcp grafana

docker attach 7d0a68fe4562

使用ssh

使用exec

docker exec -it 7d0a68fe4562 /bin/bash

使用nsenter

安裝Docker(yum安裝)

確定你是centos7及以上版本 root 192 desktop cat etc redhat release centos linux release 7.2.1511 core 3.yum安裝gcc相關 yum y install gcc yum y install gcc c 4.解除安裝舊...

安裝 python python安裝

pyenv 多版本管理工具 1.linux安裝pyenv方式 git 安裝 1 安裝git yum install git y 2 安裝python編譯依賴 yum y install gcc make patch gdbm devel openssl devel sqlite devel read...

mysql安裝(安裝包安裝)

2 使用命令列 cmd 進入mysql的bin目錄下,初始化資料庫,執行mysqld initialize console console 表示在控制台輸出,不新增則不展示下面那些資訊 最後一行root localhost 後的hd ed4j s 就是臨時密碼,登入時會使用 注意 1 data目錄要...