Я пытаюсь создать образ Docker для своего приложения Python с помощью Docker Compose. Однако процесс сборки постоянно завершается сбоем со следующими ошибками:
#41 [python_app] importing to docker
#41 ERROR: write /blobs/sha256/f2aca02e4cee21b3bc5e1be8260039722afad94fea9dd1ba970501939ed1a7d7: no space left on device
#40 [python_app] exporting to docker image format
#40 sending tarball 13.9s done
#40 ERROR: failed to copy to tar: rpc error: code = Unknown desc = io: read/write on closed pipe
------
failed to solve: failed to copy to tar: rpc error: code = Unknown desc = io: read/write on closed pipe
> [python_app] exporting to docker image format:
------
------
> [python_app] importing to docker:
------
Error: Process completed with exit code 17.
Предпринятые шаги:
Проверено место на диске:
В моей системе достаточно свободного места на диске:
Filesystem Size Used Avail Use% Mounted on
/dev/root 991G 14G 978G 2% /
Информация о докере:
Вот вывод информации о докере:
Client:
Version: 24.0.7
Context: default
Debug Mode: false
Plugins:
compose: Docker Compose (Docker Inc.)
Version: v2.28.1
Path: /home/ubuntu/.docker/cli-plugins/docker-compose
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 24.0.7
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version:
runc version:
init version:
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.8.0-1010-aws
Operating System: Ubuntu 24.04 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 957.4MiB
Name: ip-172-31-32-234
ID: 7aae3afa-250b-44f8-81d1-2b488f1bacad
Docker Root Dir: /var/lib/docker
Debug Mode: false
Username: socialmediaant
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Мой файл Docker:
# Use an official Python runtime as a parent image
FROM python:3.11-slim AS builder
# Set environment variables to avoid writing .pyc files and enable unbuffered output
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set the working directory
WORKDIR /socialmediaant/src/app/python
# Install system dependencies and Python packages
COPY requirements.txt .
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc build-essential && \
python3 -m pip install --no-cache-dir -r requirements.txt && \
apt-get purge -y gcc build-essential && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Copy the application code
COPY . .
# Use a minimal runtime image for the final stage
FROM python:3.11-slim
# Set environment variables to avoid writing .pyc files and enable unbuffered output
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set the working directory
WORKDIR /socialmediaant/src/app/python
# Copy only the necessary files from the builder stage
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /socialmediaant/src/app/python /socialmediaant/src/app/python
# Expose the port the app runs on
EXPOSE 8080
# Command to run the FastAPI app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
Docker Compose:
version: '3.8'
services:
node_app:
container_name: node
build:
context: ./backend
dockerfile: Dockerfile
image: socialmediaant/socialmediaant-node:node-latest
env_file:
- ./backend/.env
ports:
- "8001:8000"
environment:
- NODE_ENV=production
depends_on:
- database
entrypoint: ["/bin/sh", "-c", "/wait-for-it.sh database:5432 -- npm run sync-db && npm start"]
python_app:
container_name: python
build:
context: ./python
dockerfile: Dockerfile
image: socialmediaant/socialmediaant-node:python-latest
env_file:
- ./python/.env
ports:
- "8081:8080"
environment:
- PYTHON_ENV=production
depends_on:
- database
volumes:
- ./python:/socialmediaant/src/app/python
database:
container_name: database
build:
context: ./postgres
dockerfile: Dockerfile
image: socialmediaant/socialmediaant-node:database-latest
environment:
- POSTGRES_USER=admin
- POSTGRES_PASSWORD=@Social-098$%^&()
- POSTGRES_DB=socialmediaant
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:
Подробнее здесь: https://stackoverflow.com/questions/788 ... -on-closed
Сборка Docker завершается сбоем из-за ошибок «Нет места на устройстве» и «io: чтение/запись на закрытом канале». ⇐ Linux
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение