首页 > 其他分享 >Docker 安装与配置

Docker 安装与配置

时间:2023-09-15 18:46:23浏览次数:38  
标签:配置 ce version yum Docker 安装 docker latest

安装方法:

  1. yum 配置仓库安装
  2. rpm 包安装
  3. 使用docker官方提供的自动化脚本

这里以 yum 配置仓库安装为例。

确认操作系统版本

确认操作系统是否是 CentOS 7 及以上版本。

cat /etc/os-release

卸载旧版本

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

yum安装gcc相关

yum -y install gcc
yum -y install gcc-c++

安装需要的软件包

yum install -y yum-utils

设置stable镜像仓库

#yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

更新yum软件包索引

yum makecache fast

安装DOCKER CE

sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

启动Docker

sudo systemctl start docker

测试

[email protected] 15:37:36 [pwd:/home/dmdba/dmdbms/data/DMDB]# docker version
Client: Docker Engine - Community
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.20.7
 Git commit:        ed223bc
 Built:             Mon Sep  4 12:33:07 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.6
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.7
  Git commit:       1a79695
  Built:            Mon Sep  4 12:32:10 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.22
  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
 runc:
  Version:          1.1.8
  GitCommit:        v1.1.8-0-g82f18fe
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

[email protected] 15:39:43 [pwd:/home/dmdba/dmdbms/data/DMDB]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
719385e32844: Pull complete
Digest: sha256:4f53e2564790c8e7856ec08e384732aa38dc43c52f02952483e3f003afbf23db
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.

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://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

卸载

systemctl stop docker
yum remove docker-ce docker-ce-cli containerd.io
rm -rf /var/lib/docker
rm -rf /var/lib/containerd

配置阿里云镜像加速器

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<- 'EOF'
{
	"registry-mirrors": ["https://aa25.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

标签:配置,ce,version,yum,Docker,安装,docker,latest
From: https://www.cnblogs.com/lixiaomeng/p/17705717.html

相关文章

  • ES中间件安装
    首先需要创建网络:命令:dockernetworkcreatees-net                查看网络:dockernetworkls然后 下载或者导入elasticsearh.tar  然后加载:dockerload-i  tar包 然后安装es:执行如下命令dockerrun-d\ --namees\-e"......
  • Docker+harbor+rancher2.6.3部署springboot项目
    1、在pom的文件中添加以下配置<build><finalName>${project.artifactId}</finalName><plugins><plugin><groupId>com.spotify</groupId><artifactId>docker-maven-plugin</artifactId......
  • 配置 git 提交校验规则以及提交前进行代码的校验和修复
    git篇前言今日分享的话题是配置git提交校验规则以及提交前进行代码lint的校验和修复......
  • 本地搭建的Redis集群中实现配置DB0到DB255
    要在本地搭建的Redis集群中实现配置DB0到DB255,需要执行以下步骤:1.编辑Redis配置文件(redis.conf):使用文本编辑器打开redis.conf文件,找到以下配置项:```#Setthenumberofdatabases.ThedefaultdatabaseisDB0,youcanselect#adifferentoneonaper-connect......
  • idea 配置详解 (三)
    (<fontcolor="gray">VersionControl</font>......
  • ESXi esxcli 命令行创建虚拟交换机 创建虚拟网卡 配置上行链路
    ESXi  esxcli命令行创建虚拟交换机 创建虚拟网卡 配置上行链路参考整理自(    https://kb.vmware.com/s/article/1008127?lang=zh_CN   )通过ESXi/ESX中的命令行配置vSwitch或vNetworkDistributedSwitch(1008127)(vmware.com)1、创建1个虚拟交换机......
  • CentOS 7.6安装MySQL8
    下载yum源yuminstall-ywgetwgethttps://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm安装yum源rpm-ivhmysql80-community-release-el7-5.noarch.rpm安装MySQLyuminstall-ymysql-server启动mysql服务systemctlstartmysqld查看......
  • windows系统安装Python环境
    Python在此次AI浪潮中,被广泛使用,所以我们搭建一下Python的运行环境现在我安装的是Python1.10版本,没有使用最新版,是因为某些Python库不支持高版本Windows系统前往Python官网,直接下载安装程序https://www.python.org/downloads/windows/安装过程就是直接下一步,就能成功,记得勾选添......
  • word安装(ppt、excel),以及word的常用设置
    一、安装word(ppt、excel)0、关闭电脑的所有杀毒软件等到激活的时候,注意断开网络!!!一般,白嫖的时候,激活都要记得断网,杀毒软件是从下载就得关闭了!1、卸载卸载:把电脑所有和办公office相关的软件卸载了,比如:word、ppt、excel、onenote、outlook等等[具体参考下图],注意还有wps也要一起卸载......
  • 【经验与坑】git配置多账号环境
    配置流程清空默认全局配置gitconfig--global--unsetuser.namegitconfig--global--unsetuser.email为不同账户生成不同ssh-key在windows账户下,/c/User/username/.ssh下id_rsa是默认的文件名称,我们现在需要生成不同的ssh-key,所以需要设置不同的文件存储对应的公钥。这......