新闻详情

新闻详情

首页 / 资讯中心 / 详情

Dokcer(五) Dcoker的使用

发布时间:2026/9/27 22:47:40来源:尧图网络
Dokcer(五) Dcoker的使用
Docker安装Server版本以 OS版本Ubuntu 22.04 为例安装:cpu为x86_64:先卸载旧版本, 如果是新机器(云服务器or虚拟机)一般默认是没有的, 可以通过输入docker version查看, 如果没有这个命令, 就不需要卸载:如果需要卸载, 执行:# 1卸载旧版本sudoapt-getremovedockerdocker-engine docker.io containerd runc Reading package lists... Done Building dependency tree Reading state information... Done E: Unable tolocatepackage docker-engine# 2卸载历史版本# 卸载软件sudoapt-getpurge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras-y# 删除用户数据, 比如旧的容器,镜像等sudorm-rf/var/lib/dockersudorm-rf/var/lib/containerd配置 docker 下载源# 1. curl 命令安装sudoaptinstallcurl-y# 2. 添加 Docker 官方 GPG key:# 2.1 创建 gpg key 目录sudomkdir-m0755-p/etc/apt/keyrings# 2.2 下载 gpg keycurl-fsSLhttps://download.docker.com/linux/ubuntu/gpg|sudogpg--dearmor--yes-o/etc/apt/keyrings/docker.gpg添加 Docker 官方软件源# 3.1 添加 Docker 官方软件源echo\deb [arch$(dpkg --print-architecture)signed-by/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \$(lsb_release-cs)stable|sudotee/etc/apt/sources.list.d/docker.list/dev/null# 3.2 更新aptsudoapt-getupdate安装# 4. 安装sudoapt-getinstalldocker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin-y自动启动配置#配置加载sudosystemctl daemon-reload#启动服务sudosystemctl startdocker#开启启动sudosystemctlenabledocker查看服务状态sudo systemctl status docker, 可以看到docker服务正常启动6. 检查安装结果查看版本# docker版本, 可以看到客户端和服务端的版本以及组件dockerversion Client: Docker Engine - Community Version:29.8.1 API version:1.56Go version: go1.26.8 Git commit: 4a63305 Built: Tue Sep1516:25:262026OS/Arch: linux/amd64 Context: default....# 更详细查看 docker 信息dockerinfo 比如: Containers:0Running:0Paused:0Stopped:0Images:0Server Version:29.8.1 Storage Driver: overlayfs Docker Root Dir: /var/lib/docker配置Docker镜像源, 因为官网的docker hub 直连一般访问不了, 所以可以配置一些国内的镜像源,vim /etc/docker/daemon.json:{registry-mirrors:[https://镜像加速地址]}然后通过docker info, 可以看到server 配置的镜像源地址:Registry Mirrors: https://xx https://xxx运行一个helloworld试一下:sudodockerrun hello-world Unable tofindimagehello-world:latestlocally latest: Pulling from library/hello-world 4f55086f7dd0: Pull complete d5e71e642bf5: Download complete Digest: sha256:5e23090353324d887c48ad5e5c56d294eab81588df9605b07d1afe895f9cc8f8 Status: Downloaded newer imageforhello-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 thehello-worldimage from the Docker Hub.(amd64)3. The Docker daemon created a new container from that imagewhichruns the executable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client,whichsent it to your terminal. To try somethingmoreambitious, you can run an Ubuntu container with: $dockerrun-itubuntubashShare images, automate workflows, andmorewith afreeDocker ID: https://hub.docker.com/ Formoreexamples and ideas, visit: https://docs.docker.com/get-started/Docker 目录修改Docker 默认的安装目录为/var/lib/docker,这里面会存放很多很多镜像所以我们在安装的时候需要考虑这个目录的空间有三种解决方案。1将/var/lib/docker 挂载到一个大的磁盘这种一般我们能控制挂载目录像腾讯云这种云厂商在安装 K8s 的节点的时候提供了挂载选项可以直接挂载这个目录过去2安装之前挂载一个大的磁盘然后创建一个软链接到/var/lib/docker这样就自动安装到我们空间比较大的磁盘了3安装了 docker然后发现忘了配置这个目录我们需要修改 docker 的配置文件# 假定我们磁盘的大的目录为 /datamkdir-p/data/var/lib/docker# 编辑配置文件vi/etc/docker/daemon.json添加data-root: “/data/var/lib/docker”:然后, 重新加载配置并重启docker:systemctl daemon-reload,systemctl restart docker.执行docker info后, 可以查看目录修改完毕:GUI 版本安装以Windows11为例:暂存
网站建设高端定制企业官网
RELATED

相关资讯

更多精彩内容,欢迎继续阅读

较早相关资讯

最新相关资讯

Kata Containers Dragonball vCPU 管理机制解析:配置、状态机与热插拔实现 2026/9/27 23:37:24

Kata Containers Dragonball vCPU 管理机制解析:配置、状态机与热插拔实现

云原生容器运行时 【免费下载链接】kata-containers Kata Containers is an open source project and community working to build a standard implementation of lightweight Virtual Machines (VMs) that feel and perform like containers, but provide the workload isolat…

阅读更多 →
单边傅里叶/拉普拉斯变换 2026/9/27 23:37:06

单边傅里叶/拉普拉斯变换

单边变换和双边变换本质上没有太大的区别,如果信号的频率范围是有限的,实际上单边变换和双边变换的效果是一样的,只是双边变换的频谱幅值是单边变换的两倍而已,但是并不会引起频谱分析的失真。这也就是为什么cos(w0t)的傅里叶变换…

阅读更多 →
拉普拉斯变换的理解 2026/9/27 23:37:06

拉普拉斯变换的理解

1、拉普拉斯变换是信号变换的一种方式,和傅里叶变换类似,傅里叶变换是把信号拆分成e^(-jwt)的形式,傅里叶变换的结果F(jw0)就是指 e^(-jw0t)分量的大小。拉普拉式变换也是类似的,不过拉普拉斯变换是把信号拆分成e^(-σt)*e^(-jwt)…

阅读更多 →
MySQL存储过程与触发器 2026/9/27 23:36:59

MySQL存储过程与触发器

数据库是现代应用程序的核心组件之一,而在日常开发和管理中,自动化、逻辑处理和优化性能尤为重要。MySQL 中的存储过程与触发器提供了强大的工具,帮助开发者在数据库内部实现这些目标。存储过程可以让一组 SQL 语句在数据库中以预编译的方式存储,并在需要时调用。触发器则能…

阅读更多 →
ASL Alphabet图像分类实战:数据预处理、CNN与迁移学习避坑指南 2026/9/27 23:36:59

ASL Alphabet图像分类实战:数据预处理、CNN与迁移学习避坑指南

简介:面向深度学习图像分类与手语识别场景,ASL Alphabet 美国手语字母表数据集内置29类图像样本,涵盖A~Z、space、nothing、del共29个类别,每类超2000张图片,适合作为CNN、ResNet等模型的训练数据。压缩包约311MB&…

阅读更多 →
网站建设mingxinsh避坑指南:看懂建站报价才敢开工 2026/9/27 23:36:59

网站建设mingxinsh避坑指南:看懂建站报价才敢开工

网站建设mingxinsh避坑指南:看懂建站报价才敢开工 网站做好了没人访问,这是很多老板做网站后最头疼的事。你花了大几千甚至几万块钱,网站上线了,每天后台看流量只有个位数,心里直打鼓:这钱是不是打水漂了?别急,这通常不是技术问题,而是你在…

阅读更多 →

今日资讯

本周资讯

本月资讯

看完文章仍有疑问?

联系尧图顾问,获取一对一建站咨询

立即免费咨询 📞 400-888-8888
📞 ✉