You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

DockerHub镜像无法在Hugging Face Spaces中正常运行求助

问题:本地正常的Docker镜像推送到DockerHub后无法在Hugging Face Spaces运行

本地运行Docker镜像完全正常,但将其推送到DockerHub后,在Hugging Face Spaces中无法正常使用。

相关文件内容

1. Hugging Face Spaces中使用的Dockerfile

# Use the circulartextapp/speedinga:1.0 image from the Docker Hub as the base image
FROM circulartextapp/speedtime:latest

# User Setup (if needed)
RUN useradd -m -u 1001 user

# Set environment variables
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PYTHONUNBUFFERED=1

# Set the working directory in the container to the application directory
WORKDIR /code

# Copy Python requirements file
COPY requirements.txt .

# Copy your application files into the container
COPY . /code

# Expose any ports your application might use (if applicable)
EXPOSE 7860

# Specify the command to run your Node.js application
CMD ["node", "server.js"]

2. 推送到DockerHub的镜像对应的Dockerfile

# Set the working directory
WORKDIR /app

# Install system packages including ffmpeg
RUN apt-get update && \
    apt-get install -y ffmpeg && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Copy Python requirements file
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy Node.js application files
COPY package*.json .

# Install Node.js dependencies
RUN npm install

# Install Node.js dependencies, including Express
RUN npm install express
# Copy the rest of the application code
COPY . .

# Expose the application port
EXPOSE 7860

# Set the default command to start the application
CMD ["npm", "start"]

已尝试的操作

  • 移除Express依赖
  • 在Spaces的Dockerfile中直接安装Express(构建时超时30分钟)
  • 在原镜像中提前添加Express安装步骤

以上操作均未解决问题,相关错误截图和Spaces截图已留存。

内容的提问来源于stack exchange,提问作者Circulartextapps

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 00:00:21