docker 记录的一些
1、修改docker info的配置
/etc/docker/daemon.json
{
"registry-mirrors": [
"https://dockerhub.azk8s.cn",
"https://docker.mirrors.ustc.edu.cn",
"http://hub-mirror.c.163.com"
],
"default-address-pools": [
{"base":"172.70.0.0/16", "size":24},
{"base":"172.80.0.0/16", "size":24},
{"base":"172.90.0.0/16", "size":20}
],
"insecure-registries": ["0.0.0.1/0"],
"storage-driver": "overlay2",
"userland-proxy": false,
"max-concurrent-downloads": 10,
"log-driver": "json-file",
"log-level": "info",
"log-opts": {
"max-size": "10m",
"max-file": "3"
},
"default-ulimits": {
"nofile": {
"Name": "nofile",
"Hard": 655360,
"Soft": 655360
}
},
"data-root": "/data/docker"
}
2、docker日志太多导致磁盘占满
https://colobu.com/2018/10/22/no-space-left-on-device-for-docker/
3、普通用户执行docker没有权限
test@/data/casement$ docker info
Client:
Context: default
Debug Mode: false
Server:
ERROR: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/info: dial unix /var/run/docker.sock: connect: permission denied
errors pretty printing info
安装docker后默认有个docker组
需要将普通用户添加到docker组里面
sudo gpasswd -a test docker
newgrp docker
重新执行ok
4、docker 常用命令
Docker build -t tag .
Docker run -d —name=‘xx’ -p 8080:8080 nginx
5、清理
docker system prune -a