Docker CentOS release 7.2下的安装
环境介绍:
[[email protected] ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [[email protected] ~]# uname -r 3.10.0-327.el7.x86_64 [[email protected] ~]#
Docker的安装:
如果网络条件良好的情况下,直接配置yum源,yum安装,也可以提前下载好rpm包进行安装。
1、配置Docker Yum源
[[email protected] ~]# cat /etc/yum.repos.d/docker.repo [docker] name=Docker baseurl=http://yum.dockerproject.org/repo/main/centos/7/ enabled=1 gpgcheck=0
2、为使容器可以上网,开启宿主机的路由转发功能
[[email protected] ~]# echo 1 > /proc/sys/net/ipv4/ip_forward
3、安装 docker-engine 软件包
为方便后期使用,可以配置yum.conf把下载的软件包保存下来
[[email protected] yum.repos.d]# cat /etc/yum.conf keepcache=1
yum安装docker-engine
[[email protected] yum.repos.d]# yum -y install docker-engine
注:查看下载下来的软件包
[[email protected] ~]# ls /var/cache/yum/x86_64/7Server/dockerrepo/packages docker-engine-17.03.0.ce-1.el7.centos.x86_64.rpm docker-engine-selinux-17.03.0.ce-1.el7.centos.noarch.rpm
4、启动服务:
[[email protected] ~]# systemctl start docker [[email protected] ~]# systemctl enable docker #设置开机启动 docker 服务
查看docker版本信息:
[[email protected] ~]# docker info Containers: 3 Running: 0 Paused: 0 Stopped: 3 Images: 8 Server Version: 17.03.0-ce Storage Driver: overlay Backing Filesystem: xfs Supports d_type: false Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init
接下来就可以pull或load,对容器进行部署了。
时间: 2024-10-07 08:18:42