docker基础之centos安装和设置加速镜像(一)
2023-09-11 14:19:37 时间
使用 yum 安装
Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。
通过 uname -r 命令查看你当前的内核版本
uname -r 3.10.0-327.el7.x86_64
安装 Docker
从 2017 年 3 月开始 docker 在原来的基础上分为两个分支版本: Docker CE 和 Docker EE。
Docker CE 即社区免费版,Docker EE 即企业版,强调安全,但需付费使用。
本文介绍 Docker CE 的安装使用。
移除旧的版本:
$ sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-selinux \ docker-engine-selinux \ docker-engine
安装一些必要的系统工具:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
添加软件源信息:(也可以wget下载文件,复制到/etc/yum.repos.d/)
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
更新 yum 缓存:
yum makecache fast
安装 Docker-ce:
sudo yum install containerd.io docker-ce docker-ce-cli
启动 Docker 后台服务(也可以安装ntsysv工具管理开机服务)
systemctl start docker #开启 docker --version #版本 sudo systemctl enable docker #开机自启
安装 Docker Compose
方法一:
yum install docker-compose
方法二:
#1.执行如下命令安装 pip3 yum -y install python3-pip pip3 install --upgrade pip
#2.执行如下命令安装 docker-compose pip3 install docker-compose
#3.安装完毕后执行如下命令查看版本 docker-compose version
配置加速源:
阿里云加速镜像:https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
[root@localhost ~]# mkdir /etc/docker/ [root@localhost ~]# touch /etc/docker/deamon.json [root@localhost ~]# vim /etc/docker/deamon.json { "registry-mirrors": ["https://tqx543h6.mirror.aliyuncs.com"] } [root@localhost ~]# systemctl daemon-reload [root@localhost ~]# systemctl restart docker
测试运行 hello-world
docker run hello-world
安装
桌面版:https://www.docker.com/products/docker-desktop
服务器版:https://docs.docker.com/engine/install/#server
参考 :https://www.cnblogs.com/nm666/p/15249753.html
相关文章
- Error: docker-ce-cli conflicts with 2:docker-1.13.1-209.git7d71120.el7.centos.x86_64
- CentOS中利用Docker安装Redis
- 在 CentOS 6.4(64位) 安装 docker.io
- 从Docker Hub和docker-registry看优秀的后端服务设计实现
- 如何在Fedora / CentOS上面升级Docker 1.6
- Centos安装docker postgresql
- docker for windows--Windows 10 家庭中文版 21H2 安装Docker Desktop初体验
- CentOS、Kali等Linux系统安装docker
- Docker容器(五)——Docker静态化IP
- docker安装centos后没有ifconfig命令解决办法
- Centos基础环境--docker安装Redis
- Centos基础环境搭建--安装docker
- 浅析CentOS安装docker及遇到的问题:Failed to start docker.service: Unit not found或docker: command not found
- Docker安装指南——如何在Linux中安装Docker?(最新2022-2 for centOS stream 8)
- CentOS 7 Docker镜像加速器配置
- docker run -it centos /bin/bash 后面的 bin/bash的作用
- manjaro docker install ros2 in raspberry pi4B 使用Docker安装ROS2 (ros-humble) 并开启对Wayland的支持