Centos7-64位系统安装Docker
2017-07-18 09:56
603 查看
一、直接在线安装(有楼梯的话选择)
1、安装依赖包:
2、安装稳定的仓库:
1、安装依赖包:
yum install -y yum-utils device-mapper-persistent-data lvm2
2、安装稳定的仓库:
yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo[/code]
3、安装Docker(社区版)
a)更新yum的索引:yum makecache fast
b)安装最新版的Docker:yum install docker-ce
c)查看版本(安装版本排序):yum list docker-ce.x86_64 --showduplicates | sort -r
d)安装指定版本的Docker:yum install docker-ce-<VERSION>
4、启动Docker:systemctl start docker
5、测试:docker run hello-world
6、要升级Docker CE,首先快速运行sudo yum makecache,然后按照安装说明,选择要安装的新版本。
二、手动下载安装包
1、到https://download.docker.com/linux/centos/7/x86_64/stable/Packages/并下载要安装的Docker版本的.rpm文件。
2、安装:yum install /path/to/package.rpm
3、启动:systemctl start docker
4、测试:docker run hello-world
三、卸载:
1、卸载Docker软件包: yum remove docker-ce
2、删除所有图像,容器和卷:rm -rf /var/lib/docker
四、可能会出现的异常:[root@VM_162_135_centos ~]# docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world b04784fba78d: Pulling fs layer docker: error pulling image configuration: Get https://dseasb33srnrn.cloudfront.net/registry-v2/docker/registry/v2/blobs/sha256/18/1815 c82652c03bfd8644afda26fb184f2ed891d921b20a0703b46768f9755c57/data?Expires=1500279939&Signature=TTj25I73aNR5f1NMrIGFVQNX9KS99JpEn9Dd6V4XOK-Z5FLPX2gKv2kg6fubYPr-FIqnASwZ0fNzj600XQ5zv7uSEtbnXdKHu18FcjVM3eJ~df6bXWqcJml9QqiF07ZHm0udzIOpr2tVD64YFFeNvw~1pJKBpAHTA2th~V1gpa8_&Key-Pair-Id=APKAJECH5M7VWIS5YZ6Q: net/http: TLS handshake timeout.See 'docker run --help'.
解决方案:#vim /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE='eth0' NM_CONTROLLED='yes' ONBOOT='yes' IPADDR='10.104.162.135' NETMASK='255.255.192.0' GATEWAY='10.104.128.1' #新增以下代码 DNS1=8.8.8.8 #Google的DNS DNS2=114.114.114.114 #电信的DNS # service network restart
再次启动即可:[root@VM_162_135_centos ~]# docker run hello-world WARNING: IPv4 forwarding is disabled. Networking will not work. Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://cloud.docker.com/ For more examples and ideas, visit: https://docs.docker.com/engine/userguide/[/code]
对于:WARNING: IPv4 forwarding is disabled. Networking will not work.的解决办法:# vi /etc/sysctl.conf 或者 # vi /usr/lib/sysctl.d/00-system.conf 添加如下代码: net.ipv4.ip_forward=1 重启network服务 # systemctl restart network 查看是否修改成功 # sysctl net.ipv4.ip_forward 如果返回为“net.ipv4.ip_forward = 1”则表示成功
这时启动docker时将不会显示WARNING: IPv4 forwarding is disabled. Networking will not work.[root@VM_162_135_centos ~]# docker run hello-world Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://cloud.docker.com/ For more examples and ideas, visit: https://docs.docker.com/engine/userguide/[/code]
到此Docker安装完成!
相关文章推荐
- CentOS-64位系统下安装MySQL-5.6.10
- 64位CentOs6.5系统阿里云服务器源码安装MySql5
- CentOS 64位系统JDK1.6、tomcat 6.0、MySQL 5.5安装指南
- Centos系统下docker的安装与卸载
- CentOS 6.4 64位系统U盘安装
- CentOS6.5_64位系统下安装配置postfix邮件系统 启用并配置SMTP在第三方上边使用发送邮件
- 在64位的CentOS 6.8上安装系统性能监测工具Monitorix
- 【Linux】【Docker】CentOS6.9主机上Docker Ubuntu14.04系统安装CUDA问题Module nvidia-uvm not found
- CentOS6.4 64位系统安装jdk
- CentOS 64位系统 yum安装32位软件包的方法
- 64位CentOS系统中安装32位开发库
- 17090202_Win7(64位)下光盘安装/构建CentOS7(64位)双系统教程
- CentOS系统下docker的安装配置及使用详解
- centos7.0 64位系统安装 nginx
- Win7安装64位CentOS 6.4双系统详细过程
- 在centos 6 64位系统上安装broadcom网卡驱动
- CentOS6.4 64位系统安装jdk
- CentOS系统下docker的安装配置及使用详解
- CentOS 64位系统安装32位兼容库
- docker+node+Cordova 多平台流媒体直播系统 一 centos6.5 源码编译安装node5.8(1)