dockerdocker-composenextcloud

How to remove everything associated with NextCloud Docker Containers so that I can re-install fresh?


I am looking to remove everything associated with NextCloud so that I can do a clean install and instead keep getting an older instance.

I installed NextCloud (along with nginx, letsencrypt, and maria) via a docker compose file (see below). When I went to log in for the first time, I ran into an issue with MariaDB and could not complete the initial login.

While I was trouble-shooting, I tried the initial login with SQLite and it worked, but I didn't want to run SQLite in production. I eventually found a command to include in the MariaDB definition and went to do a clean install.

I tried docker-compose down and then docker compose up -d, but that pointed me back to the instance with SQLite.

I stopped all of the NextCloud containers and ran docker system prune --volumes -a followed by docker-compose up -d. This re-downloaded and extracted all of the docker images. When I went back to the NextCloud URL, it still pointed me to the SQLite instance instead of the clean install I was looking for.

What are some other things I can try to get that clean install?

version: '3' 

services:

  proxy:
    image: jwilder/nginx-proxy:alpine
    labels:
      - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
    container_name: nextcloud-proxy
    networks:
      - nextcloud_network
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./proxy/conf.d:/etc/nginx/conf.d:rw
      - ./proxy/vhost.d:/etc/nginx/vhost.d:rw
      - ./proxy/html:/usr/share/nginx/html:rw
      - ./proxy/certs:/etc/nginx/certs:ro
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    restart: unless-stopped
  
  letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: nextcloud-letsencrypt
    depends_on:
      - proxy
    networks:
      - nextcloud_network
    volumes:
      - ./proxy/certs:/etc/nginx/certs:rw
      - ./proxy/vhost.d:/etc/nginx/vhost.d:rw
      - ./proxy/html:/usr/share/nginx/html:rw
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    restart: unless-stopped

  db:
    image: mariadb
    container_name: nextcloud-mariadb
    networks:
      - nextcloud_network
    volumes:
      - db:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MYSQL_ROOT_PASSWORD=toor
      - MYSQL_PASSWORD=mysql
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
    restart: unless-stopped
    command: ['--innodb_read_only_compressed=OFF'] 
  
  app:
    image: nextcloud:latest
    container_name: nextcloud-app
    networks:
      - nextcloud_network
    depends_on:
      - letsencrypt
      - proxy
      - db
    volumes:
      - nextcloud:/var/www/html
      - ./app/config:/var/www/html/config
      - ./app/custom_apps:/var/www/html/custom_apps
      - ./app/data:/var/www/html/data
      - ./app/themes:/var/www/html/themes
      - /etc/localtime:/etc/localtime:ro
    environment:
      - VIRTUAL_HOST=your-subdomain.duckdns.org
      - LETSENCRYPT_HOST=your-subdomain.duckdns.org
      - LETSENCRYPT_EMAIL=you@youremail.com
    restart: unless-stopped

volumes:
  nextcloud:
  db:

networks:
  nextcloud_network:

Solution

  • It appears that you have "bind volumes" on some of your containers. especially on your nextcloud-app instance.

    this command doesn't remove bind volumes. Only managed volumes.

    docker system prune --volumes -a
    

    Next cloud may have persisted some configuration data in the folder ./app

    therefore if you want to reset it copletely you need to stop all containers, remove this folder by hand. remove managed volumes. and restart it all