开启docker服务
centeros7以及之后版本: systemctl start docker
centeros6以及之前的版本: service docker start
查看已有镜像
docker images
抓取镜像
镜像查询地址: https://dev.aliyun.com/list.html
命令: docker pull path
需要抓取的镜像:
centeros: docker pull registry.cn-hangzhou.aliyuncs.com/moensun/centos7
删除镜像
命令: docker rmi 镜像ID
创建容器
命令:docker run -tid 镜像ID /bin/bash --这种创建方式用于 非centeros7系统
docker run -tid --privileged 镜像ID /usr/sbin/init --这种创建方式用于 centeros7
查看已创建的容器列表
命令:docker ps -a
修改容器名称
命令:docker rename 容器名称
进入容器
命令: docker exec -it 容器名称 /bin/bash
停止容器
命令: docker stop 容器名称
停止容器后再次启动该容器
先用docker ps -a找到对应的已经停止了的容器id,然后用docker start -ia <containerid>启动容器
删除容器
注意:如果要删除容器,需要先将要删除的容器停止
命令: docker rm 容器名称