tilt-dev / tilt

Define your dev environment as code. For microservice apps on Kubernetes.
https://tilt.dev/
Apache License 2.0
7.68k stars 303 forks source link

Docker-Compose eats up all space with unused subvolumes #5355

Open KnowZero opened 2 years ago

KnowZero commented 2 years ago

I am not sure if this is a bug or a feature request or maybe I am doing something wrong.

I am trying to implement usage of tilt with docker compose and rust with live updates. But after a few hours of working, I get errors that I am out of space and the source is the subvolumes in /var/lib/docker/bfrs/ so I tried switching to overlay2 and same issue of /var/lib/docker/overlay2/ taking up all the space. I tried adding pruning to the tilt file in hopes it would solve my problem but no luck.

Looking around, I see that the unused subvolumes taking up space is a known docker issue. But if it isn't cleaning up unused subvolumes, it makes it hard to develop on.

Is there a setting in tilt to fix this? or maybe some workaround? or am I simply doing something wrong?

tilt file:

docker_prune_settings( 
  disable = False , 
  max_age_mins = 360 , 
  num_builds = 5 , 
  keep_recent = 2 
  )

docker_compose("./development/docker-compose.yml")

docker_build('feed-ps-rust', '.', build_args={}, dockerfile='./feed-ps/debug.Dockerfile',
  live_update = [
    sync('./feed-ps', '/opt/FeedPs/feed-ps'),
    run('cargo build'),
    restart_container()
  ])

docker compose file:

version: "3.9"
services:
  web:
    image: feed-ps-rust
    build:
        context: ./../feed-ps
        dockerfile: ./debug.Dockerfile
    ports:
        - 3002:3000
    environment:
        - REDIS_URL=redis://feed-ps-cache
        - PORT=3000
    command:
        sh -c './target/debug/feed_ps'
    links:
        - redis
  redis:
    image: redis
    container_name: feed-ps-cache
    expose:
        - 6379

docker file:

FROM rust:slim-buster

WORKDIR /opt/FeedPs/feed-ps

RUN mkdir src && echo "" > src/lib.rs
COPY ./feed-ps/Cargo.lock .
COPY ./feed-ps/Cargo.toml .
RUN cargo build --lib

COPY ../schema ../schema

COPY ../store ../store

ADD ./feed-ps .
ENV RUST_BACKTRACE=1

RUN cargo build

ENTRYPOINT ./target/debug/feed_ps

Tilt doctor output:

Tilt: v0.23.4, built 2021-12-17
System: linux-amd64
---
Docker
- Host: [default]
- Server Version: 20.10.9-ce
- API Version: 1.41
- Builder: 2
- Compose Version: v1.29.2 (build unknown)
---
Kubernetes
- Env: none
- Context: 
- Cluster Name: Unknown
- Namespace: default
- Container Runtime: unknown
- Version: Error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
- Cluster Local Registry: none
lianmakesthings commented 2 years ago

Hi @KnowZero, thanks for filing this issue. I just want to make sure I understand your problem correctly. Is it the same issue that has been filed here? https://github.com/moby/moby/issues/9939 If you just run a regular docker system prune does that remove the subvolumes as expected?

Mithras commented 1 year ago

I also noticed that I have thousands of docker btrfs subvolumes and docker system prune -a --volumes doesn't seem to do anything about them.

joelhinch commented 4 weeks ago

Hi @KnowZero, thanks for filing this issue. I just want to make sure I understand your problem correctly. Is it the same issue that has been filed here? moby/moby#9939 If you just run a regular docker system prune does that remove the subvolumes as expected?

No, it does not clean them up. Docker has wiped its hands of them as far as its concerned.