天天看点

Docker 基础10命令汇总附

删除数据

[root@h103 ~]# ll /var/lib/docker
total 16
drwx------ 3 root root   77 Jan 19 17:37 containers
drwx------ 5 root root   50 Jan 19 17:37 devicemapper
drwx------ 5 root root 4096 Jan 19 17:37 graph
-rw-r--r-- 1 root root 5120 Jan 19 17:37 linkgraph.db
drwxr-x--- 3 root root   18 Jan 19 17:20 network
-rw------- 1 root root  110 Jan 19 17:37 repositories-devicemapper
drwx------ 2 root root    6 Jan 19 17:37 tmp
drwx------ 2 root root    6 Jan 19 17:20 trust
drwx------ 2 root root    6 Jan 19 17:20 volumes
[root@h103 ~]# du -sh /var/lib/docker
61M	/var/lib/docker
[root@h103 ~]# rm -rf /var/lib/docker
[root@h103 ~]# du -sh /var/lib/docker
du: cannot access ‘/var/lib/docker’: No such file or directory
[root@h103 ~]#            

复制

其它配置文件可以根据具体项目进行定位和清理

命令汇总

  • hostnamectl

  • yum update

  • tee /etc/yum.repos.d/docker.repo <<-'EOF'

  • cat /etc/yum.repos.d/docker.repo

  • yum install docker-engine

  • service docker start

  • systemctl status docker.service

  • rpm -qi systemd

  • docker run hello-world

  • curl -sSL https://get.docker.com/ | sh

  • cat /etc/yum.repos.d/docker-main.repo

  • usermod -aG docker cc

  • id cc

  • su - cc

  • docker run hello-world

  • systemctl enable docker.service

  • systemctl list-unit-files | grep docker

  • systemctl list-dependencies docker.service

  • cat /usr/lib/systemd/system/docker.service

  • cat /usr/lib/systemd/system/docker.socket

  • ll /var/run/docker.sock

  • systemctl enable docker.socket

  • yum list installed | grep docker

  • yum -y remove docker-engine.x86_64

  • rm -rf /var/lib/docker

systemctl用法小结

CLI COMMENT
systemctl is-enabled *.service 查询服务是否开机启动
systemctl enable *.service 开机运行服务
systemctl disable *.service 取消开机运行
systemctl start *.service 启动服务
systemctl stop *.service 停止服务
systemctl restart *.service 重启服务
systemctl reload *.service 重新加载服务配置文件
systemctl status *.service 查询服务运行状态
systemctl –failed 显示启动失败的服务
systemctl list-unit-files 查看所有服务及开机启动状态
systemctl list-dependencies *.service 查看服务依赖

原文地址