惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
GbyAI
GbyAI
aimingoo的专栏
aimingoo的专栏
L
LangChain Blog
I
InfoQ
D
Docker
F
Fortinet All Blogs
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
月光博客
月光博客
B
Blog
Engineering at Meta
Engineering at Meta
T
Tailwind CSS Blog
罗磊的独立博客
博客园_首页
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog RSS Feed
IT之家
IT之家
V
V2EX

博客园 - 斌言

Claude Code + deepseek在Windows环境上的搭建教程 unable to access 'https://github.com/langgenius/dify.git/': Failed to connect to github.com port 443 after 21111 ms: Could not connect to server .NET6 MVC 无刷新上传文件 docker快速搭建部署mqtt ubuntu安装smaba CentOS7.9安装Docker centos7.9 安装 openGauss 5.0.0 CentOS 7 yum安装MongoDB CentOS 7.4安装.NET6 react native SectionList组件实现多选 react-native-vector-icons 安装 apk文件查看指纹证书方法 server2008 安装mongodb supervisor 安装及基本使用 WinForms 嵌入 Web服务 ASP.NET Core http请求内容过大, IIS服务器 返回 Request Too Long 解决方案 ASP.NET Core MVC中调用Json()时默认使用Newtonsoft.Json返回数据 react native android9 axios network error .NET Core3.1升级.NET5 oracle连接报错
docker部署.NET6并挂载目录
斌言 · 2025-02-25 · via 博客园 - 斌言

1: 创建Dockerfile

#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 8075 
#8075需要和appsettings.json文件中的配置的端口保持一致

#设置时区
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# 复制所有文件到工作目录
COPY . .

# 设置运行时的启动命令  test.dll填写你自己项目的dll
ENTRYPOINT ["dotnet", "test.dll"]

 2: 构建并运行Docker容器,挂载代码目录

# 构建Docker镜像
docker build -t test .

# 运行容器,挂载你的代码目录到容器内的/app目录  在这里,/path/to/your/code应该替换为你的本地代码目录的路径。这样,当你修改本地代码时,容器内的应用将自动更新,无需重新构建镜像
docker run -d -p 8075:8075 --name yourappcontainer -v /path/to/your/code:/app yourappname

posted @ 2025-02-25 17:12  斌言  阅读(50)  评论()    收藏  举报