1.安装:
centos 6 :
yum install docker-io -y service docker start
centos 7:
yum install docker service docker start
2.常用命令:
查看、查找、推拉
docker version/info docker images docker search centos docker pull centos:latest
备份、恢复
docker save -o ~/container-backup.tar container-backup docker load -i ~/container-backup.tar
加标签,推送
docker tag centos 10.16.27.190:443/centosbb docker push 10.16.27.190:443/centosbb
运行容器:
docker run --name=ansible-using -it ansible-server-latest /bin/bash docker exec -it ansible-server-latest /bin/bash
删除容器:
docker ps -a | grep "Exited" | awk '{print $1}' |xargs -I {} docker rm -f {} docker stop $(docker ps -a -q) docker rmi -f $(docker images | grep "^<none>" | awk '{print $3}')
安装本地仓库:
docker run -idt -p 5000:5000 --name registry -v /apps/registry:/tmp/registry registry