Docker安装详细步骤

Docker安装详细步骤

1、安装环境准备

主机:192.168.40.5 zch01

设置主机名

hostnamectl set-hostname zch01 && bash

配置hosts文件

root@ \~\]# vi /etc/hosts 添加如下内容: 192.168.40.5 zch01 ### 关闭防火墙 \[root@zch01 \~\]# systemctl stop firewalld \&\& systemctl disable firewalld ### 关闭selinux \[root@zch01 \~\]# setenforce 0 \[root@zch01 \~\]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config #重启生效 \[root@zch01 \~\]# reboot 查看设置 ![](https://file.jishuzhan.net/article/1697478453894320129/bc479fe875ba45199ba895081f1b5c84.png) ### 安装基础软件包 因为之前在做很多实验的时候,很多时候需要操作相关命令,一个一个安装起来非常麻烦,所以索性一次性都安装比较简单,只是可能比较耗时 \[root@zch01 \~\]# yum wget net-tools nfs-utils lrzsz gcc gcc-c++ make cmake libxml2-devel openssl-devel curl curl-devel unzip sudo libaio-devel wget ncurses-devel autoconf automake zlib-devel python-devel epel-release openssh-server ## 2、Docker安装 ### 配置docker阿里云yum源 \[root@zch01 \~\]# yum-config-manager --add-repo [http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo](http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo "http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo") ### 安装docker依赖包 \[root@zch01 \~\]# yum install -y yum-utils device-mapper-persistent-data lvm2 ### docker-ce社区版本安装 \[root@zch01 \~\]# yum install docker-ce -y 启动docker并设置为开机自启动 \[root@zch01 \~\]# systemctl start docker \&\& systemctl enable docker ### 查看docker 状态 \[root@zch01 \~\]# systemctl status docker ![](https://file.jishuzhan.net/article/1697478453894320129/02259c7293374dbca3d198dec499d71e.png) 当看到是running 表示正常运行状态 查看当前安装的docker版本,默认是安装最新版本 \[root@zch01 \~\]# docker version ![](https://file.jishuzhan.net/article/1697478453894320129/c4115e8d667743d8935bfcdc6420357d.png) 到此docker 已经安装成功了。

相关推荐
代码游侠2 分钟前
学习笔记——ARM Cortex-A 裸机开发实战指南
linux·运维·开发语言·前端·arm开发·笔记
weixin_307779135 分钟前
在AWS上构建类Manus的生产级AI Agent服务
运维·人工智能·云计算·aws·agi
汪汪大队u9 分钟前
各类 NAT 的差异
运维·服务器
DN金猿26 分钟前
ubuntu在apt安装时出现的弹窗详解
linux·运维·ubuntu
大地的一角43 分钟前
(Linux)进程间通信
linux·运维·服务器
cly11 小时前
Jenkins重置管理员密码
运维·servlet·jenkins
Flash.kkl8 小时前
Linux——进程信号
运维·服务器
苏宸啊9 小时前
Linux权限
linux·运维·服务器
Gofarlic_oms19 小时前
Windchill用户登录与模块访问失败问题排查与许可证诊断
大数据·运维·网络·数据库·人工智能
xqhoj9 小时前
Linux——make、makefile
linux·运维·服务器