colima icon indicating copy to clipboard operation
colima copied to clipboard

Can't cache layers with docker-compose

Open ldanielw1 opened this issue 1 year ago • 1 comments

Description

On a installation of colima with docker + docker-compose on an m1 mac. It's strange that I can run docker build . and the layers will cache... but then when I run docker-compose build... the layers don't (and they wipe out any layers cached by the previous call to docker build. All of this is done without changing the local files at all.

I also noticed that every time I run docker-compose build, the number of layers is increasing in my colima machine's /var/lib/docker/overlay2. So I'm guessing it just can't find the cached layers and is continuing to create new layers in that folder?

At this point, I honestly can't tell if this is a docker-compose bug or a colima bug... though I never experienced this when I was on Docker Desktop.

here's my docker-compose.yml file:

services:
  db:
    build: { context: ., dockerfile: ./Dockerfile }
    container_name: db
    env_file: [ .env ]
    ports: ["$DB_PORT:$DB_PORT"]
    volumes:
      - $DB_MOUNT:/opt/prod/db/data
      - $DB_CONF_MOUNT:/opt/prod/db/conf/mariadb/server
      - $DB_SECRETS_MOUNT:/opt/prod/db/secrets
      - $DB_SSL_PUBLIC_MOUNT:/opt/prod/db/conf/mariadb/ssl_public
      - $DB_SSL_MOUNT:/opt/prod/db/conf/mariadb/ssl
    networks: [ container-network ]
    user: "${CONTAINER_UID}:myuser"
    logging: { driver: "json-file", options: { max-size: "10m", max-file: "10" } }
    security_opt:
      - no-new-privileges:true
    userns_mode: keep-id:uid=${CONTAINER_UID}

networks:
  container-network:
    name: my-container-network

Version

colima 0.6.8 docker 26.1.1 docker-compose 2.27.0

Operating System

  • [ ] macOS Intel <= 13 (Ventura)
  • [ ] macOS Intel >= 14 (Sonoma)
  • [ ] Apple Silicon <= 13 (Ventura)
  • [x] Apple Silicon >= 14 (Sonoma)
  • [ ] Linux

Output of colima status

INFO[0000] colima is running using macOS Virtualization.Framework 
INFO[0000] arch: aarch64                                
INFO[0000] runtime: docker                              
INFO[0000] mountType: sshfs                             
INFO[0001] socket: unix:///Users/dwu/.colima/default/docker.sock 

ldanielw1 avatar May 09 '24 08:05 ldanielw1

This should be resolved now. Can you try the development version brew install --head colima.

Thanks.

abiosoft avatar Jul 24 '24 04:07 abiosoft