网站首页 > 基础教程 正文
目录
- 1,关于debian镜像
- 2,nodejs使用debian镜像
- 3,总结
1,关于debian镜像
为啥要使用debian镜像呢?
首先 centos的官网已经不支持了,慢慢的也就没落了。也不乏新的版本了。
万一linux 新的内核有性能和安全的提升也得不到更新支持了。
我们就是做应用开发的,不折腾底层的这些事情。
那为啥不选择 alpine 镜像呢,主要还是 alpine的源的软件偏少。
发现的各种问题解决起来麻烦。用alpine的主要是因为这个镜像小。
但是其实 debian的 slim 版本镜像其实也很小呢!
debian 的 slim 版本有 30MB,alpine 就3MB,确实差很多。
但是习惯上和后期维护上还是 debian 更方便些。到时候要是再换镜像就麻烦了。
并不是简单的仅仅从大小上看看的。
https://www.debian.org/releases/index.zh-cn.html
debian的版本说明:
下一代 Debian 正式发行版的代号为 bookworm — 测试(testing)版 — 发布日期尚未确定
Debian 11 (bullseye) — 当前的稳定(stable)版
Debian 10(buster) — 当前的旧的稳定(oldstable)版
Debian 9(stretch) — 更旧的稳定(oldoldstable)版,现有长期支持
Debian 8(jessie) — 已存档版本,现有扩展长期支持
推荐大家就使用 bullseye 版本就行,也是很稳定的版本。
感觉上ubuntu 比较适合做桌面有版本改动或者迭代的差异比较大。
debian给人更加稳定的感觉。
电脑上面安装的linux是 xubuntu 版本,服务器就使用 debian 版本。命令配置都差不多。
还是非常好的。
2,nodejs使用debian镜像
https://developer.aliyun.com/mirror/debian
国内可以增加阿里源的镜像地址:
debian 11.x (bullseye)
编辑/etc/apt/sources.list文件(需要使用sudo), 在文件最前面添加以下条目(操作前请做好相应备份)
deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
如果要是再服务器端进行构建docker的nodejs镜像,需要使用:
docker run -itd -p 8080:8080 -v `pwd`:/data node:18-bullseye-slim
然后就可以在镜像中操作node配置了。
npm config set registry https://registry.npmmirror.com
或者执行的时候设置:
npm install --registry=https://registry.npmmirror.com
然后使用docker镜像把编译好的代码,放到nginx上。
# build front-end
FROM node:18-bullseye-slim AS frontend
# RUN npm install pnpm -g --registry=https://registry.npmmirror.com
WORKDIR /app
COPY . /app
RUN yarn install --registry=https://registry.npmmirror.com && \
yarn run build
# service
# 这个是 debian 11 的版本
FROM nginx:stable
COPY --from=frontend /app/dist /usr/share/nginx/html
EXPOSE 443
3,总结
python:3.8-slim-bullseye,这个也是debian11 的版本
总结起来,使用debian的镜像还是非常的方便的。
后续相关的资料和技术都比较成熟了,镜像也就省一点点的磁盘。
因为镜像是一次层一层的,一个镜像小了30M,其实也还好。
关键是服务稳定,和扩展、维护性更好。像 TF,pytorch等机器学习的框架都上G的镜像。
用的是 ubuntu 比较多,综合看没有必要极致的使用 alpine。
要是再安装个 ffmpeg,opencv,啥的估计太浪费时间折腾了。
猜你喜欢
- 2024-12-08 被 Docker 日志坑惨了
- 2024-12-08 软路由的用法(自动追剧配置)
- 2024-12-08 Docker 使用命令
- 2024-12-08 WizNote-为知笔记Docker私有部署教程
- 2024-12-08 在 Linux Debian 上安装配置 Kubernetes 集群
- 2024-12-08 有毒的Docker:功能简单但使用复杂,分分钟找出替代品?
- 2024-12-08 玩Docker,不求人~保姆级入门教程!
- 2024-12-08 Docker镜像服务器关停,“硬控”国内NAS玩家?解决方法来咯!!
- 2024-12-08 Docker最全详解(万字图文总结)
- 2024-12-08 Debian 12.8 发布 | Mistral AI 推出批量 API,成本降低 50%
- 最近发表
-
- 在使用Bootstrap吗?快来看看如何使用 Bootswatch 主题吧
- 50个HTML5免费的Bootstrap模板 :下
- 定制你的bootstrap之--修改less文件1
- BootstrapBlazor :使用 .NET 生成交互式客户端 Web UI 的框架
- React与使用Bootstrap5模态框的注意事项
- 如何引用bootstrap没有的字体图标
- 10个超酷炫Bootstrap HTML & CSS UI工具包
- Bootstrap自举电路工作原理讲解(自举电路的原理)
- 为何 BootstrapVue 能成为 Vue 前端框架顶流?
- 新增 创意布局企业网络服务CSS模板 bootstrap 模板
- 标签列表
-
- jsp (69)
- gitpush (78)
- gitreset (66)
- python字典 (67)
- dockercp (63)
- gitclone命令 (63)
- dockersave (62)
- linux命令大全 (65)
- pythonif (86)
- location.href (69)
- dockerexec (65)
- tail-f (79)
- queryselectorall (63)
- location.search (79)
- bootstrap教程 (74)
- deletesql (62)
- linuxgzip (68)
- 字符串连接 (73)
- html标签 (69)
- c++初始化列表 (64)
- mysqlinnodbmyisam区别 (63)
- arraylistadd (66)
- mysqldatesub函数 (63)
- window10java环境变量设置 (66)
- c++虚函数和纯虚函数的区别 (66)