linux安装docker、卸载

1.安装Docker 1.CentOS 6

  • 可以使用EPEL库安装Docker,命令如下
sudo yum install http://mirrors.yun-idc.com/epel/6/i386/epel-release-6-8.noarch.rpm sudo yum install docker-io

2.CentOS 7
  • 本系统库中已经有Docker,可直接安装(默认不是最新版本):
sudo yum install docker

  • 安装最新版:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 sudo yum-config-manage --add-repo https://mirros.aliyun.com/docker-ce/linux/centos/docker-ce.repo sudo yum install docker-ce

  • 配置阿里docker加速器:
    该路径新建daemon.json,如果启动报错,直接配置成daemon.conf
vi /etc/docker/daemon.conf

{ "registry-mirrors":[" https://kzorq22x.mirror.aliyuncs.com"] }

  • 重启docker服务
systemctl daemon-reload systemctl restart docker

【linux安装docker、卸载】3.测试
docker pull registry docker run -d --name reg -p 5000:5000 -v /docker-data/reg:/var/lib/registry registry

访问:http://172.16.223.132:5000/v2/_catalog
2.docker-compose安装
sudo curl -L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose

3.卸载:
1.查询安装过的包:
yum list installed | grep docker
2.删除安装的包
yum -y remove xxxx.xx_xx
3.删除镜像、容器等
rm -rf /var/lib/docker

    推荐阅读