Docker的基本组成和安装

Docker的基本组成

镜像(image):

docker镜像就好比是一个模板,可以通过这个模板来创建容器服务,tomcat镜像 ==> run ==> tomcat01容器(提供服务)

通过这个镜像可以创建多个容器(最终服务运行或者项目运行就是在容器中的)

容器(container):

Docker利用容器技术,独立运行一个或者一个组应用,通过镜像来创建的。

启动,停止,删除,基本命令。

目前就可以把这个容器理解为一个简易的linux系统

仓库(repository):

仓库就是存在镜像的地方,仓库分为共有仓库和私有仓库

Docker Hub(默认是国外的) 阿里云。。都有容器服务器,配置镜像加速。

安装Docker

环境准备

1.需要会一点点的linux的基础

2.Centos7

3.使用Xshell连接远程服务器进行操作。

环境查看

#系统内核环境是 3.10

root@VM-8-13-centos /\]# uname -r 3.10.0-1160.62.1.el7.x86_64 #系统版本 \[root@VM-8-13-centos /\]# cat /etc/os-release NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7" # 安装 # 1.卸载旧的版本 yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine # 2.需要的安装包 yum install -y yum-utils # 3.设置镜像的仓库 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软件包索引 # 4.安装docker相关 ce社区 ee企业 yum install docker-ce docker-ce-cli containerd.io # 5.启动docker systemctl start docker # 6. 测试docker是否启动成功 docker version # 7.helloworld docker run hello-world # 8. 查看一下下载的这个hello-world镜像 [root@VM-8-13-centos /]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest feb5d9fea6a5 10 months ago 13.3kB ![在这里插入图片描述](https://file.jishuzhan.net/article/1699106994465542146/617ee602c2184a198cb4fe2e43ed30c3.png) ### 了解:卸载docker # 1.卸载依赖 yum remove docker-ce docker-ce-cli containerd.io # 2.删除资源 rm -rf /var/lib/docker # /var/lib/docker docker的默认工作路径! ### 阿里云镜像加速 1.登录阿里云找到镜像服务 ![在这里插入图片描述](https://file.jishuzhan.net/article/1699106994465542146/24a112fb143b4b07bd9159be725eb6f7.png) 2.找到镜像加速地址 ![在这里插入图片描述](https://file.jishuzhan.net/article/1699106994465542146/87a90e23b92a4f3eb0e325e300c84bf8.png) 3.配置使用 sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json \<\<-'EOF' { "registry-mirrors": \["https://8a8gh67k.mirror.aliyuncs.com"\] } EOF sudo systemctl daemon-reload sudo systemctl restart docker

相关推荐
数据知道2 小时前
容器化部署:用Docker封装机器翻译模型与服务详解
docker·容器·机器翻译
一只栖枝2 小时前
华为 HCIE 大数据认证中 Linux 命令行的运用及价值
大数据·linux·运维·华为·华为认证·hcie·it
wuicer4 小时前
ubuntu 20.04 安装anaconda以及安装spyder
linux·运维·ubuntu
小晶晶京京6 小时前
day34-LNMP详解
linux·运维·服务器
fengyehongWorld7 小时前
Linux crontab定时任务
linux·运维
碎像7 小时前
Linux上配置环境变量
linux·运维·服务器
40kuai8 小时前
kubernetes中数据存储etcd
容器·kubernetes·etcd
敲上瘾8 小时前
Linux系统cgroups资源精细化控制基础
linux·测试工具·docker·压力测试·cgroups
sunflower_w9 小时前
linux I2C核心、总线与设备驱动
linux·运维·服务器
myzzb9 小时前
基于uiautomation的自动化流程RPA开源开发演示
运维·python·学习·算法·自动化·rpa