Nextcloud docker-compose with ffmpeg example

Hi,

I am new to NC, I am new to docker (docker-compose). I have docker-compose.yml, I am running in on mac-mini.

My docker-compose.yml looks like this:

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
#      - ./proxy/conf.d/custom.conf:/etc/nginx/conf.d/custom.conf:rw
    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=...
      - MYSQL_PASSWORD=...
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
    restart: unless-stopped

  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
#      - /Volumes/T7/nextcloud:/var/www/html/data:rw
      - ./app/data:/var/www/html/data
      - /Volumes/T7/nextcloud:/mnt/T7/nextcloud:rw
      - ./app/themes:/var/www/html/themes
      - /etc/localtime:/etc/localtime:ro
    environment:
      - NEXTCLOUD_CHECK_DATA_DIRECTORY_PERMISSIONS=false
      - NC_CHECK_DATA_DIRECTORY_PERMISSIONS=false
      - VIRTUAL_HOST=...,192.168.1.100
      - LETSENCRYPT_HOST=...
      - LETSENCRYPT_EMAIL=...
      - TRUSTED_PROXIES=192.168.0.0/16,172.19.0.0/16
    restart: unless-stopped

  cron:
    image: nextcloud:latest
    restart: always
    volumes:
      - nextcloud:/var/www/html
    entrypoint: /cron.sh
    depends_on:
      - db

volumes:
  nextcloud:
  db:

networks:
  nextcloud_network:

I would like to add permanently ffmpeg, but I really dont know how to do it, can somebody help me, or show me how it should look like ? I tried different stuff, but none of them works properly.

Thanks

Github repo of Nextcloud Docker images has an .examples folder with Dockerfile`s adding optional functionality. most likely you can adopt the aproach

Another - of course quick and dirty - solution is to do this

docker exec --user root nextcloud bash -c "apt update && apt -y install libmagickcore-6.q16-6-extra smbclient iputils-ping nmap mc btop net-tools ncdu java-common default-jre graphicsmagick ffmpeg ghostscript"

because imho there are more then ffmpeg you should be install. BTW if you modify the Dockerfile you have to build the image. My opinion is to leave the image origin and add additional packages but both is possible.

1 Like

Thanks, I just used that method for installing ffmpef in my Nextcloud container:

podman exec nextcloud bash -c "apt update && apt -y install ffmpeg"
podman exec nextcloud whereis ffmpeg

How solve the problem than the installed packages dissapears every time you pull the docker images?

hi @robertoprubio welcome to the forum :handshake:

this is not a “problem” but exactly the way how docker is supposed to work. Containers are fluent object and you are not expected to change them. If you need additional packages you can build you own images (one can derive from existing) adding required packages to the config. see examples at docker/.examples at master · nextcloud/docker · GitHub.