Dockerfile文件详细教程
写在前面
Dockerfile是用来构建镜像的,他实际上就是把在linux下的命令操作写到了Dockerfile中,通过Dockerfile去执行设置好的操作命令,保证通过Dockerfile的构建镜像是一致的。
实战分析
该例子来自于 chromium 项目
主要干的事情:
- 来指定用哪个镜像;
- 安装一些编译需要的环境:C++编译环境,Java环境等
# This Dockerfile specifies the recipe for creating an image for the tests
# to run in.
#
# We install as many test dependencies here as we can, because these setup
# steps can be cached. They do *not* run every time we run the build.
# The Docker image is only rebuilt when the Dockerfile (ie. this file)
# changes.# 指定了使用什么镜像 debian
# Base Dockerfile for gRPC dev images
FROM debian:latest# 添加软件源
# Apt source for old Python versions.
RUN echo 'deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu trusty main' > /etc/apt/sources.list.d/deadsnakes.list && \apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DB82666C# Apt source for Oracle Java.
RUN echo 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main' > /etc/apt/sources.list.d/webupd8team-java-trusty.list && \apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && \echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections# Apt source for Mono
RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list && \echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list && \apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF# Apt source for php
RUN echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu trusty main" | tee /etc/apt/sources.list.d/various-php.list && \apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F4FCBB07# Install dotnet SDK based on https://www.microsoft.com/net/core#debian
# (Ubuntu instructions need apt to support https)
RUN apt-get update && apt-get install -y --force-yes curl libunwind8 gettext && \curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=847105 && \mkdir -p /opt/dotnet && tar zxf dotnet.tar.gz -C /opt/dotnet && \ln -s /opt/dotnet/dotnet /usr/local/bin# Install dependencies. We start with the basic ones require to build protoc
# and the C++ build
RUN apt-get clean && apt-get update && apt-get install -y --force-yes \autoconf \autotools-dev \build-essential \bzip2 \ccache \curl \gcc \git \libc6 \libc6-dbg \libc6-dev \libgtest-dev \libtool \make \parallel \time \wget \# -- For csharp --mono-devel \referenceassemblies-pcl \nunit \# -- For all Java builds -- \maven \# -- For java_jdk6 -- \# oops! not in jessie. too old? openjdk-6-jdk \# -- For java_jdk7 -- \openjdk-7-jdk \# -- For java_oracle7 -- \oracle-java7-installer \# -- For python / python_cpp -- \python-setuptools \python-pip \python-dev \python2.6-dev \python3.3-dev \python3.4-dev \# -- For Ruby --ruby \# -- For C++ benchmarks --cmake \# -- For PHP --php5.6 \php5.6-dev \php5.6-xml \php7.0 \php7.0-dev \php7.0-xml \phpunit \valgrind \libxml2-dev \&& apt-get clean##################
# C# dependenciesRUN wget www.nuget.org/NuGet.exe -O /usr/local/bin/nuget.exe##################
# Python dependencies# These packages exist in apt-get, but their versions are too old, so we have
# to get updates from pip.RUN pip install pip --upgrade
RUN pip install virtualenv tox yattag##################
# Ruby dependencies# Install rvm
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
RUN \curl -sSL https://get.rvm.io | bash -s stable# Install Ruby 2.1, Ruby 2.2 and JRuby 1.7
RUN /bin/bash -l -c "rvm install ruby-2.1"
RUN /bin/bash -l -c "rvm install ruby-2.2"
RUN /bin/bash -l -c "rvm install jruby-1.7"
RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"##################
# Java dependencies# This step requires compiling protoc. :(ENV MAVEN_REPO /var/maven_local_repository
ENV MVN mvn --batch-modeRUN cd /tmp && \git clone https://github.com/google/protobuf.git && \cd protobuf && \git reset --hard 129a6e2aca95dcfb6c3e717d7b9cca1f104fde39 && \./autogen.sh && \./configure && \make -j4 && \cd java && \$MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO && \cd ../javanano && \$MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO##################
# PHP dependencies.
RUN wget http://am1.php.net/get/php-5.5.38.tar.bz2/from/this/mirror
RUN mv mirror php-5.5.38.tar.bz2
RUN tar -xvf php-5.5.38.tar.bz2
RUN cd php-5.5.38 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.5-zts && \make && make install && cd ..
RUN cd php-5.5.38 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.5 && \make && make install && cd ..RUN wget http://am1.php.net/get/php-5.6.30.tar.bz2/from/this/mirror
RUN mv mirror php-5.6.30.tar.bz2
RUN tar -xvf php-5.6.30.tar.bz2
RUN cd php-5.6.30 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.6-zts && \make && make install && cd ..
RUN cd php-5.6.30 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.6 && \make && make install && cd ..RUN wget http://am1.php.net/get/php-7.0.18.tar.bz2/from/this/mirror
RUN mv mirror php-7.0.18.tar.bz2
RUN tar -xvf php-7.0.18.tar.bz2
RUN cd php-7.0.18 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.0-zts && \make && make install && cd ..
RUN cd php-7.0.18 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-7.0 && \make && make install && cd ..RUN wget http://am1.php.net/get/php-7.1.4.tar.bz2/from/this/mirror
RUN mv mirror php-7.1.4.tar.bz2
RUN tar -xvf php-7.1.4.tar.bz2
RUN cd php-7.1.4 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.1-zts && \make && make install && cd ..
RUN cd php-7.1.4 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-7.1 && \make && make install && cd ..RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php composer-setup.php
RUN mv composer.phar /usr/bin/composer
RUN php -r "unlink('composer-setup.php');"
RUN composer config -g -- disable-tls true
RUN composer config -g -- secure-http false
RUN cd /tmp && \rm -rf protobuf && \git clone https://github.com/google/protobuf.git && \cd protobuf && \git reset --hard 49b44bff2b6257a119f9c6a342d6151c736586b8 && \cd php && \ln -sfn /usr/local/php-5.5/bin/php /usr/bin/php && \ln -sfn /usr/local/php-5.5/bin/php-config /usr/bin/php-config && \ln -sfn /usr/local/php-5.5/bin/phpize /usr/bin/phpize && \composer install && \mv vendor /usr/local/vendor-5.5 && \ln -sfn /usr/local/php-5.6/bin/php /usr/bin/php && \ln -sfn /usr/local/php-5.6/bin/php-config /usr/bin/php-config && \ln -sfn /usr/local/php-5.6/bin/phpize /usr/bin/phpize && \composer install && \mv vendor /usr/local/vendor-5.6 && \ln -sfn /usr/local/php-7.0/bin/php /usr/bin/php && \ln -sfn /usr/local/php-7.0/bin/php-config /usr/bin/php-config && \ln -sfn /usr/local/php-7.0/bin/phpize /usr/bin/phpize && \composer install && \mv vendor /usr/local/vendor-7.0 && \ln -sfn /usr/local/php-7.1/bin/php /usr/bin/php && \ln -sfn /usr/local/php-7.1/bin/php-config /usr/bin/php-config && \ln -sfn /usr/local/php-7.1/bin/phpize /usr/bin/phpize && \composer install && \mv vendor /usr/local/vendor-7.1##################
# Go dependencies.
RUN apt-get install -y \# -- For go -- \golang##################
# Javascript dependencies.
RUN apt-get install -y \# -- For javascript -- \npm##################
# Python 3.5 3.6 dependencies.
RUN apt-get clean && apt-get update && apt-get install -y --force-yes \python3.5-dev \python3.6-dev \&& apt-get clean# On Debian/Ubuntu, nodejs binary is named 'nodejs' because the name 'node'
# is taken by another legacy binary. We don't have that legacy binary and
# npm expects the binary to be named 'node', so we just create a symbol
# link here.
RUN ln -s `which nodejs` /usr/bin/node##################
# Prepare ccacheRUN ln -s /usr/bin/ccache /usr/local/bin/gcc
RUN ln -s /usr/bin/ccache /usr/local/bin/g++
RUN ln -s /usr/bin/ccache /usr/local/bin/cc
RUN ln -s /usr/bin/ccache /usr/local/bin/c++
RUN ln -s /usr/bin/ccache /usr/local/bin/clang
RUN ln -s /usr/bin/ccache /usr/local/bin/clang++# Define the default command.
CMD ["bash"]
常见命令解释
FROM 指定镜像源
FROM ubuntu
# Base Dockerfile for gRPC dev images
FROM debian:latest
网站:http://hub.docker.com
FROM命令是用来指定你需要用哪个镜像作为基础镜像进行构建,一般来说Dockerfile的第一行都会先指定一个镜像,官方仓库中有很多镜像,可以通过http://hub.docker.com进行搜索,建议尽量使用官方镜像作为基础镜像,因为官方镜像都是精简过的稳定版。
RUN 执行linux命令
比如我们需要安装vim
写法1:
RUN apt-get update -y
RUN apt-get install -y vim
RUN是用来执行linux命令的指令,例如ubuntu系统下,需要更新软件包list,就需要执行apt-get update,之后会跟着执行apt-get install
写法2:
RUN apt-get update -y \&& apt-get install -y vim
参考例子:
# Apt source for old Python versions.
RUN echo 'deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu trusty main' > /etc/apt/sources.list.d/deadsnakes.list && \apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DB82666C# Apt source for Oracle Java.
RUN echo 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main' > /etc/apt/sources.list.d/webupd8team-java-trusty.list && \apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && \echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections# Apt source for Mono
RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list && \echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list && \apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF# Apt source for php
RUN echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu trusty main" | tee /etc/apt/sources.list.d/various-php.list && \apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F4FCBB07# Install dotnet SDK based on https://www.microsoft.com/net/core#debian
# (Ubuntu instructions need apt to support https)
RUN apt-get update && apt-get install -y --force-yes curl libunwind8 gettext && \curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=847105 && \mkdir -p /opt/dotnet && tar zxf dotnet.tar.gz -C /opt/dotnet && \ln -s /opt/dotnet/dotnet /usr/local/bin# Install dependencies. We start with the basic ones require to build protoc
# and the C++ build
RUN apt-get clean && apt-get update && apt-get install -y --force-yes \autoconf \autotools-dev \build-essential \bzip2 \ccache \curl \gcc \git \libc6 \libc6-dbg \libc6-dev \libgtest-dev \libtool \make \parallel \time \wget \# -- For csharp --mono-devel \referenceassemblies-pcl \nunit \# -- For all Java builds -- \maven \# -- For java_jdk6 -- \# oops! not in jessie. too old? openjdk-6-jdk \# -- For java_jdk7 -- \openjdk-7-jdk \# -- For java_oracle7 -- \oracle-java7-installer \# -- For python / python_cpp -- \python-setuptools \python-pip \python-dev \python2.6-dev \python3.3-dev \python3.4-dev \# -- For Ruby --ruby \# -- For C++ benchmarks --cmake \# -- For PHP --php5.6 \php5.6-dev \php5.6-xml \php7.0 \php7.0-dev \php7.0-xml \phpunit \valgrind \libxml2-dev \&& apt-get clean##################
# C# dependenciesRUN wget www.nuget.org/NuGet.exe -O /usr/local/bin/nuget.exe##################
# Python dependencies# These packages exist in apt-get, but their versions are too old, so we have
# to get updates from pip.RUN pip install pip --upgrade
RUN pip install virtualenv tox yattag##################
# Ruby dependencies# Install rvm
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
RUN \curl -sSL https://get.rvm.io | bash -s stable# Install Ruby 2.1, Ruby 2.2 and JRuby 1.7
RUN /bin/bash -l -c "rvm install ruby-2.1"
RUN /bin/bash -l -c "rvm install ruby-2.2"
RUN /bin/bash -l -c "rvm install jruby-1.7"
RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"
USER 指定当前用户
USER root
USER username
EXPOSE 暴露端口
声明端口,作用是帮助镜像使用者理解这个镜像服务的守护端口,以方便配置映射。在运行时使用随机端口映射时,也就是 docker run -P时,会自动随机映射EXPOSE的端口。
EXPOSE <端口1> [<端口2>...]
在 Dockerfile 中写入这样的声明有两个好处:
- 一个是帮助镜像使用者理解这个镜像服务的守护端口,以方便配置映射;
- 另一个用处则是在运行时使用随机端口映射时,也就是 docker run -P 时,会自动随机映射 EXPOSE 的端口。
例子:
EXPOSE 端口号
EXPOSE 端口号/协议
默认协议是 TCP
EXPOSE 80/tcp
EXPOSE 80/udp
FROM nginx
EXPOSE 80
在docker-compose中
通常在docker-compose中,会通过ports来映射并暴露端口,docker-compose用法如下:
ports:- "8001:80"
相关文章:
Dockerfile文件详细教程
写在前面 Dockerfile是用来构建镜像的,他实际上就是把在linux下的命令操作写到了Dockerfile中,通过Dockerfile去执行设置好的操作命令,保证通过Dockerfile的构建镜像是一致的。 实战分析 该例子来自于 chromium 项目 主要干的事情…...

机器学习-模型评估与选择
文章目录 评估方法留出法交叉验证自助法 性能的衡量回归问题分类问题查准率、查全率与F1ROC与AUC 在机器学习中,我们通常面临两个主要问题:欠拟合和过拟合。欠拟合指模型无法在训练数据上获得足够低的误差,通常是因为模型太简单,无…...
分享一下办公自动化常用的思想
目录 网页获取数据需求①大体思路:PythonseleniumXpath 网页获取数据需求②大体思路:requests爬虫 批量生成需求①文件的移动、重命名②word、Excel批量生成 匹配需求 网页获取数据需求① 大体思路:PythonseleniumXpath 我们在利用Python做…...

mac vscode 使用 clangd
C 的智能提示 IntelliSense 非常不准,我们可以使用 clangd clangd 缺点就是配置繁琐,优点就是跳转和提示代码精准 开启 clangd 之后会提示你关闭 IntelliSense 1、安装插件 clangd 搜索第一个下载多的就是 2、配置 clangd 可执行程序路径 clangd 插…...

DSI及DPHY的学习
DSI的物理层PHY只能是DPHY 本节讲述的DSI是V1.02.00---2010.6.28 从DSI V1.02开始DSI支持图像数据包RGB和YCbCr的传输,在此版本之前只支持RGB传输。 本节内容与CSICDPHY相同时 请参考: CSI2与CDPHY学习-CSDN博客 同时本节会做一些与CSICDPHY的比较 …...

环形链表(C++解法)
题目 给你一个链表的头节点 head ,判断链表中是否有环。 如果链表中有某个节点,可以通过连续跟踪 next 指针再次到达,则链表中存在环。 为了表示给定链表中的环,评测系统内部使用整数 pos 来表示链表尾连接到链表中的位置&#…...

星闪技术 NearLink 一种专门用于短距离数据传输的新型无线通信技术
本心、输入输出、结果 文章目录 星闪技术 NearLink 一种专门用于短距离数据传输的新型无线通信技术前言星闪技术 NearLink 的诞生背景星闪技术 NearLink 简介星闪技术 NearLink 技术是一种蓝牙技术吗星闪技术 NearLink 优势星闪技术 NearLink 应用前景弘扬爱国精神星闪技术 Nea…...
【Python机器学习】零基础掌握RandomForestRegressor集成学习
如何预测房价是不是一直困扰着大家?特别是在房地产市场波动不定的情况下,这样的预测可以说是切实需要。 要解决这个问题,一个可行的方法是利用历史房价数据和房屋的各种属性(如面积、楼层、地理位置等)进行分析。通过这些数据,可以用一个模型来预测未来房价。 假设有以…...

FreeRTOS深入教程(任务创建的深入和任务调度机制分析)
文章目录 前言一、深入理解任务的创建二、任务的调度机制1.FreeRTOS中任务调度的策略2.FreeRTOS任务调度策略实现的核心3.FreeRTOS内部链表源码解析4.如何通过就绪链表管理任务的执行顺序 三、一个任务能够运行多久1.高优先级任务可抢占低优先级任务一直运行2.相同优先级的任务…...

Megatron-LM GPT 源码分析(一) Tensor Parallel分析
引言 本文基于开源代码 GitHub - NVIDIA/Megatron-LM: Ongoing research training transformer models at scale ,通过GPT的模型运行示例,从三个维度 - 模型结构、代码运行、代码逻辑说明 对其源码做深入的分析。 Tensor Parallel源码分析...

分类预测 | MATLAB实现SSA-CNN-GRU麻雀算法优化卷积门控循环单元数据分类预测
分类预测 | MATLAB实现SSA-CNN-GRU麻雀算法优化卷积门控循环单元数据分类预测 目录 分类预测 | MATLAB实现SSA-CNN-GRU麻雀算法优化卷积门控循环单元数据分类预测分类效果基本描述程序设计参考资料 分类效果 基本描述 1.MATLAB实现SSA-CNN-GRU麻雀算法优化卷积门控循环单元数据…...

婚礼的魅力
昨日有幸被邀请去当伴郎,虽然是替补,即别人鸽了,过去救急,但总归是去起作用。 婚礼的魅力,感受到了,满满的仪式感,紧凑的流程,还有不断的拍照,做视频,留下美好…...

【计算机网络笔记】DNS报文格式
DNS 提供域名到主机IP地址的映射 域名服务的三大要素: 域(Domain)和域名(Domain name): 域指由地 理位置或业务类型而联系在一起的一组计算机构 成。 主机:由域名来标识。域名是由字符和(或&a…...

10月28日
...

【性能测试】初识 Jmeter 中的 BeanShell
初识 Jmeter 中的 BeanShell 1.简介1.1 应用场景1.2 BeanShell 类型 2.常用内置变量2.1 log 日志模块2.2 vars 模块2.3 props 模块2.4 prev 模块 3.常见应用场景3.1 Java 文件处理3.2 导入外部 jar 包 BeanShell 是一个小型嵌入式 Java 源代码解释器,完全兼容 Java …...
Rust实现基于Tokio的限制内存占用的channel
Rust实现基于Tokio的限制内存占用的channel 简介 本文介绍如何基于tokio的channel实现一个限制内存占用的channel。 Tokio提供了多种协程间同步的接口,用于在不同的协程中同步数据。 常用的channel有两种:bounded和unbounded,其中ubbounded的channel可…...

【C++】C++入门(上)--命名空间 输入输出 缺省参数 函数重载
目录 一 命名空间 1 命名空间的定义 2 命名空间的使用 二 C输入和输出 1 输出 2 输入 三 缺省参数 1 缺省参数概念 2 缺省参数分类 (1) 全缺省参数 (2)半缺省参数 四 函数重载 1 函数重载概念 2 分类 1 参数类型不同 2 参数个数不同 3 参数类型顺序不同 3 C为什…...

设计模式:原型模式(C#、JAVA、JavaScript、C++、Python、Go、PHP)
上一篇《访问者模式》 下一篇《享元模式》 简介: 原型模式,它是一种创建型设计模式,它允许通过复制原型对象来创建新的对象,而无需知道创建的细节。其工作原…...

SpringMVC 资源状态转移RESTful
文章目录 1、RESTful简介a>资源b>资源的表述c>状态转移 2、RESTful的实现HiddenHttpMethodFilterRESTful案例 1、RESTful简介 REST:Representational State Transfer,表现层资源状态转移。 a>资源 资源是一种看待服务器的方式,…...
verilog vscode linux
安装 vscode 插件 插件:Verilog-HDL/SystemVerilog/Bluespec SystemVerilog 功能:.xdc .ucf .v 等代码高亮、代码格式化、语法检查(Linting)、光标放到变量上提示变量的信息等 关于其他语言的依赖工具等信息查看插件说明 代码对齐…...
椭圆曲线密码学(ECC)
一、ECC算法概述 椭圆曲线密码学(Elliptic Curve Cryptography)是基于椭圆曲线数学理论的公钥密码系统,由Neal Koblitz和Victor Miller在1985年独立提出。相比RSA,ECC在相同安全强度下密钥更短(256位ECC ≈ 3072位RSA…...
k8s从入门到放弃之Ingress七层负载
k8s从入门到放弃之Ingress七层负载 在Kubernetes(简称K8s)中,Ingress是一个API对象,它允许你定义如何从集群外部访问集群内部的服务。Ingress可以提供负载均衡、SSL终结和基于名称的虚拟主机等功能。通过Ingress,你可…...

边缘计算医疗风险自查APP开发方案
核心目标:在便携设备(智能手表/家用检测仪)部署轻量化疾病预测模型,实现低延迟、隐私安全的实时健康风险评估。 一、技术架构设计 #mermaid-svg-iuNaeeLK2YoFKfao {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg…...
Oracle查询表空间大小
1 查询数据库中所有的表空间以及表空间所占空间的大小 SELECTtablespace_name,sum( bytes ) / 1024 / 1024 FROMdba_data_files GROUP BYtablespace_name; 2 Oracle查询表空间大小及每个表所占空间的大小 SELECTtablespace_name,file_id,file_name,round( bytes / ( 1024 …...
解决本地部署 SmolVLM2 大语言模型运行 flash-attn 报错
出现的问题 安装 flash-attn 会一直卡在 build 那一步或者运行报错 解决办法 是因为你安装的 flash-attn 版本没有对应上,所以报错,到 https://github.com/Dao-AILab/flash-attention/releases 下载对应版本,cu、torch、cp 的版本一定要对…...
Device Mapper 机制
Device Mapper 机制详解 Device Mapper(简称 DM)是 Linux 内核中的一套通用块设备映射框架,为 LVM、加密磁盘、RAID 等提供底层支持。本文将详细介绍 Device Mapper 的原理、实现、内核配置、常用工具、操作测试流程,并配以详细的…...

USB Over IP专用硬件的5个特点
USB over IP技术通过将USB协议数据封装在标准TCP/IP网络数据包中,从根本上改变了USB连接。这允许客户端通过局域网或广域网远程访问和控制物理连接到服务器的USB设备(如专用硬件设备),从而消除了直接物理连接的需要。USB over IP的…...

GitFlow 工作模式(详解)
今天再学项目的过程中遇到使用gitflow模式管理代码,因此进行学习并且发布关于gitflow的一些思考 Git与GitFlow模式 我们在写代码的时候通常会进行网上保存,无论是github还是gittee,都是一种基于git去保存代码的形式,这样保存代码…...

【C++特殊工具与技术】优化内存分配(一):C++中的内存分配
目录 一、C 内存的基本概念 1.1 内存的物理与逻辑结构 1.2 C 程序的内存区域划分 二、栈内存分配 2.1 栈内存的特点 2.2 栈内存分配示例 三、堆内存分配 3.1 new和delete操作符 4.2 内存泄漏与悬空指针问题 4.3 new和delete的重载 四、智能指针…...

uniapp手机号一键登录保姆级教程(包含前端和后端)
目录 前置条件创建uniapp项目并关联uniClound云空间开启一键登录模块并开通一键登录服务编写云函数并上传部署获取手机号流程(第一种) 前端直接调用云函数获取手机号(第三种)后台调用云函数获取手机号 错误码常见问题 前置条件 手机安装有sim卡手机开启…...