docker

centos安装

docker部署(centos)
1、添加yum源

# yum install epel-release –y# yum clean all# yum list

2、安装并运行docker

# yum install docker-io –y# systemctl start docker

3、检查安装结果

# docker info

ubuntu安装

1、更新下软件仓库

# apt-get upgrade

2、docker安装

# apt-get install docker-engine(或者 apt-get insall docker.io)

3、查看安装结果

# docker info


docker 换源操作

修改 vi /etc/docker/daemon.json文件(没有创建新的文件)

添加内容:

                  {

                    "registry-mirrors": [

                    "https://d8b3zdiw.mirror.aliyuncs.com"

                        ],

                    "insecure-registries": [

                    "https://ower.site.com"

                        ],

                        }

重载文件:systemctl daemon-reload

重启docker:systemctl restart docker

docker常用命令

docker [run|start|stop|restart|kill|rm|pause|unpause] #容器生命周期管理

  docker [ps|inspect|top|attach|events|logs|wait|export|port]      #容器操作运维

  docker [commit|cp|diff]                                          #容器rootfs命令

  docker [login|pull|push|search]                                  #镜像仓库

  docker [images|rmi|tag|build|history|save|import]                #本地镜像管理

删除docker:https://www.jianshu.com/p/2bb5eca8d04c

卸载docker:https://www.jianshu.com/p/438f5fdc696b

碰到的问题:

解决Error response from daemon: Get https://registry-1.docker.io/v2/library/hello-world/manifests/

一直报错:

[root@archlinux ~]# docker image pull library/hello-world Using default tag: latest Error response from daemon: Get [https://registry-1.docker.io/v2/library/hello-world/manifests/latest](https://registry-1.docker.io/v2/library/hello-world/manifests/latest): dial tcp 52.20.146.203:443: i/o timeout

1.通过dig @114.114.114.114 registry-1.docker.io找到可用IP

#dig @114.114.114.114 registry-1.docker.io

2.编辑 vi /etc/hosts

添加上述IP地址任意一个写入到文件中(尽量全部加入)

54.236.131.166 registry-1.docker.io

你可能感兴趣的:(docker)