项目同级目录下 制作Dockerfile
# 使用官方的 Python 基础镜像
FROM python:3.9-slim
# 设置工作目录
WORKDIR /app
# 将当前目录内容复制到容器的工作目录
COPY . /app
# 安装 Python 依赖
RUN pip install --no-cache-dir -r requirements.txt
# 暴露5000端口
EXPOSE 5000
# 容器启动时执行的命令
CMD ["python", "app.py"]
**构建镜像命令**
docker build -t you_name .
#登录docker
docker login
#制作tag标签
docker tag 镜像id hub用户名/镜像名
docker tag 镜像id hub用户名/镜像名:1.0
#上传hub
docker push hub用户名/镜像名
docker push hub用户名/镜像名:1.0
#docker 下载
docker pull hub用户名/镜像名
评论(0)