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
相关产品推荐
相关产品推荐

