Docker基础用法
来自CloudWiki
下载源改为国内下载源
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://76880b6f.m.daocloud.io
sudo systemctl restart docker
查看Docker信息
docker info
Containers: 1 Running: 0 Paused: 0 Stopped: 1 Images: 1 Server Version: 18.06.0-ce Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs
搜索镜像
maxin@maxin-virtual-machine:~$ sudo docker search centos
NAME DESCRIPTION STARS OFFICIAL AUTOMATED centos The official build of CentOS. 4419 [OK] ansible/centos7-ansible Ansible on Centos7 114 [OK] jdeathe/centos-ssh CentOS-6 6.9 x86_64 / CentOS-7 7.4.1708 x86_… 97 [OK] consol/centos-xfce-vnc Centos container with "headless" VNC session… 57 [OK] imagine10255/centos6-lnmp-php56 centos6-lnmp-php56
获得一个镜像
sudo docker pull centos
查看已下载的镜像
maxin@maxin-virtual-machine:~$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest 2cb0d9787c4d 9 days ago 1.85kB centos latest 49f7960eb7e4 6 weeks ago 200MB
镜像的导出
maxin@maxin-virtual-machine:~$ sudo docker save 2cb0d9787c4d > ~/backup.tar
maxin@maxin-virtual-machine:~$ ls
backup.tar Desktop Documents Downloads examples.desktop Music Pictures Public Templates Videos
镜像的导入
docker load < backup.tar
返回 Docker