docker安装
#卸载docker
yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine -y
rm -rf /var/lib/docker
#设置源
yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#查看可安装docker版本
yum list docker-ce --showduplicates | sort -r
#安装并运行Docker。
yum -y install docker-ce-20.10.10-3.el7
yum install docker-io -y #不推荐
systemctl start docker
#检查安装结果。
docker info
#启动使用Docker
systemctl start docker #运行Docker守护进程
systemctl stop docker #停止Docker守护进程
systemctl restart docker #重启Docker守护进程
systemctl enable docker #开机自启
#修改镜像仓库
vim /etc/docker/daemon.json
#改为下面内容,然后重启docker
{
"debug":true,"experimental":true,
"registry-mirrors":["https://pb5bklzr.mirror.aliyuncs.com","https://hub-mirror.c.163.com","https://docker.mirrors.ustc.edu.cn"],
"live-restore": true
}
#查看信息
docker info
#权限问题
sestatus
setenforce 0
vim /etc/selinux/config
#查看容器所属用户和组
docker run -ti --rm --entrypoint="/bin/sh" b4tman/squid -c "whoami && id"
#添加组并指定id
groupadd -g 3128 squid
#添加用户并指定id
useradd squid -u 3128 -g squid
#目录赋权
chmod -R 777 /opt/docker/squid5
#给所有文件指定用户和用户组
chown -R squid.squid /opt/docker/squid5
#查看卷
docker inspect 971fc3edd389 | grep Mounts -A 10
#docker daemon日志
sudo journalctl -fu docker.service
容器更改镜像
sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list
cat /etc/apt/sources.list
rm -rf /var/lib/apt/lists/*
apt-get update
容器更改内部时间 (faketime)
#参考https://www.codenong.com/cs109844255/
vim /root/.bashrc
#添加内容
export LD_PRELOAD=/usr/local/lib/faketime/libfaketime.so.1
export FAKETIME="-365d";
#配置生效
source /root/.bashrc
#查看时间
date "+%Y-%m-%d %H:%M:%S"
jupyter
jupyter-notebook --allow-root --ip=0.0.0.0 --port=8888
k8s
# 批量删除容器
kubectl get pods -n storage | grep Evicted | awk '{print$1}'| xargs kubectl delete pods -n storage
标签:--,squid,yum,常用命令,docker,com,Docker
From: https://www.cnblogs.com/ltspring/p/17501853.html