docker 镜像重命名#
docker tag 99e59f495ffa gcr.io/google_containers/pause-amd64:3.0
如何找出docker容器日志文件
容器日志一般存放在/var/lib/docker下面,可使用如下命令查看各个日志的文件大小
ls -lh $(find /var/lib/docker/containers/ -name *-json.log)
如何清理日志
如果docker容器正在运行,那么使用rm -rf 方式删除日志后,通过df -h会发现磁盘空间并没有释放
原因:在Linux或者Unix系统中,通过rm或者文件管理器删除文件将会从文件系统的目录结构上解除链接(unlink).然而如果文件是被打开的(有一个进程正在使用),那么进程将仍然可以读取该文件,磁盘空间也一直被占用
正确姿势是cat /dev/null > *-json.log,当然你也可以通过rm删除后重启docker
清理脚本:
#!/bin/sh
echo "==================== start clean docker containers logs =========================="
logs=$(find /var/lib/docker/containers/ -name *-json.log)
for log in $logs
do
echo "clean logs : $log"
cat /dev/null > $log
done
echo "==================== end clean docker containers logs =========================="
cd3
https://www.cnblogs.com/findumars/p/5509279.html
当然你可能并不关系磁盘还剩余多少空间,你是需要知道当前的文件夹下的磁盘使用情况:
[root@localhost ~]# du --max-depth=1 -h
1 怎样安装docker
https://yq.aliyun.com/articles/110806
step 1: 安装必要的一些系统工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Step 2: 添加软件源信息
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Step 3: 列举出来有哪些docker的版本可以安装
yum list docker-ce.x86_64 --showduplicates | sort -r
image.png
Step4: 指定版本来安装
yum -y install docker-ce-[VERSION]
比如 我想安装 17的版本
yum -y install docker-ce-17.12.1.ce-1.el7.centos
Step 5:安装完毕,把docker服务启动起来
service docker start
Step 6: 把docker服务加入到系统启动项里面,以便系统重启,docker也能自动起来
systemctl start docker && systemctl enable docker
2: 如果安装错了,想卸载,参考下面的链接
https://blog.csdn.net/a527219336/article/details/50800181
卸载
列出你安装过的包
$ yum list installed | grep docker
yum list installed | grep docker
docker-engine.x86_64 1.7.1-1.el7 @/docker-engine-1.7.1-1.el7.x86_64.rpm
删除安装包
$ sudo yum -y remove docker-engine.x86_64
删除镜像/容器等
$ rm -rf /var/lib/docker
检查一下是真的删除完毕
docker version
image.png
kubeadm init --kubernetes-version=v1.10.0 --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=192.168.142.67
kubeadm join 192.168.142.67:6443 --token 2za3g1.a9qdwarc3ttxn19o --discovery-token-ca-cert-hash sha256:d4b67b0ca3355962fdc8c77a6ad0b7ea3900c04d5a678a8fd6da8630c6a452af
Your Kubernetes master has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
You can now join any number of machines by running the following on each node
as root:
kubeadm join 192.168.142.67:6443 --token 2za3g1.a9qdwarc3ttxn19o --discovery-token-ca-cert-hash sha256:d4b67b0ca3355962fdc8c77a6ad0b7ea3900c04d5a678a8fd6da8630c6a452af
3 手动拉取 heapster镜像
官方镜像拉取不下来
docker pull registry.cn-shenzhen.aliyuncs.com/rancher_cn/heapster-amd64:v1.3.0
docker pull registry.cn-shenzhen.aliyuncs.com/rancher_cn/heapster-grafana-amd64:v4.0.2
docker pull registry.cn-shenzhen.aliyuncs.com/rancher_cn/heapster-influxdb-amd64:v1.1.1
网友评论