This is my blogs kongs|

kongshuo

园龄:4年粉丝:26关注:6

docker安装

配置网络准备环境

配置网络
[root@localhost ~]# nmcli connection modify ens32 ipv4.addresses 192.168.10.10/24 ipv4.gateway 192.168.10.2 ipv4.dns 8.8.8.8 ipv4.method manual 
[root@localhost ~]# nmcli connection reload 
[root@localhost ~]# nmcli connection up ens160
测试网络
[root@localhost ~]# ping www.baidu.com
关闭防火墙和selinux
[root@localhost ~]# systemctl disable --now firewalld
[root@localhost ~]# vim /etc/selinux/config
SELINUX=disabled
[root@localhost ~]# setenforce 0
更新yum源
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo  http://mirrors.aliyun.com/repo/Centos-7.repo

设置docker仓库并安装要安装的包

安装工具包
[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
设置远程仓库
[root@localhost ~]# yum-config-manager --add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

安装docker-ce

清理老的docker
[root@localhost ~]# yum remove docker docker-client docker-client-latest docker-common \
   docker-latest docker-latest-logrotate docker-logrotate docker-engine
安装docker
[root@localhost ~]# yum -y install docker-ce
#安装指定版docker-ce
[root@localhost ~]# yum -y install docker-ce-19.03.2-3.el7 docker-ce-cli-19.03.2-3.el7 containerd.io

启动docker并设置开机自启

[root@localhost ~]# systemctl enable --now docker

测试docker

[root@localhost ~]# docker run hello-world
nable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:97a379f4f88575512824f3b352bc03cd75e239179eea0fecc38e597b2209f49a
Status: Downloaded newer image for hello-world:latest

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.
    (amd64)
 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.

一键脚本安装

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

本文作者:kongshuo

本文链接:https://www.cnblogs.com/kongshuo/p/16010298.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   kongshuo  阅读(76)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起