SIGN IN / UP
    opened image

    FileBrowser provides a file management interface on your server. A good replacement for file managers like FileZilla, WinSCP, etc. It can be used to upload, delete, preview, rename, and edit various files. There is also the ability to create users and assign them permissions. Create temporary links to files or folders.

    In this article, we will look at how to install it in a Docker container, using docker-compose as well.

     

    Installing Docker. 

     

    But first, we need to update the OS packages. 
     

    apt update


    We will install the necessary packages and add a new repository:

     

     

    apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
    
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

     


    We will update the packages with the new repository:

     

     

     

    apt update

     


    Now we will install Docker itself.

     

     

     

    apt-get install docker-ce docker-ce-cli containerd.io

     


    Check the version:

     

     

     

    docker --version

     


    Check the status:

     

     

    systemctl status docker

     


    If it hasn't started, we start it:

     

     

     

    systemctl start docker
    

     


    And add it to autostart.

     

     

     

    systemctl enable docker
    

     


     

    Installing Docker-Compose

     

     

    For this project, version 1.25 will be sufficient. 
     

    curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    


    Set execution permissions. 

     

     

    chmod +x /usr/local/bin/docker-compose
    

     


    Check how Docker-Compose was installed:

     

     

     

    docker-compose --version
    

     




    Add the Linux user to the docker group:

     

     

     

     

    usermod -aG docker $USER
    

     


    Create a *.yaml  file for Docker-Compose.

    To keep track of what we have installed in the future, let's create a separate folder for this project in the /home directory and navigate to it.

     

     

    mkdir /home/filebrowser && cd /home/filebrowser

     

    You can also use another directory  to place this and other projects. 

    We will use the repository to create the docker-compose.yaml file at the link https://hub.docker.com/r/filebrowser/filebrowser

    Create a file docker-compose.yaml or docker-compose.yml,

     

     

    vim docker-compose.yaml
    

     

    And add the following code to it:

     

     

    version: '3.3'
    services:
        filebrowser:
            container_name: filebrowser
            volumes:
            - /:/srv
            - /root/filebrowser/datbase/filebrowser.db:/database/filebrowser.db
            environment:
            - PUID=0
            - PGID=0
            ports:
            - 9090:80
            restart: always
            image: filebrowser/filebrowser:s6

     


    Where:

    container_name: the name of your container;
    In the volumes  block, specify the paths where the database will be saved and the folder with files. In this example,  / (root) is specified, which allows access to all files on the server. 
    ports: 9090 - the port through which the manager panel will be accessed.


    Also, before starting docker-compose, create a file for the database filebrowser.db at the path specified in volumes -  /root/filebrowser/database/
    If this is not done, we will see an error in the logs: filebrowser.db is a directory. 

    Run the script (you need to be in the directory where our file was created. In this case, it is /home/filebrowser/):

     

     

     

    docker-compose up -d 
    

     

    Wait for the images to download and deploy.

    Check:

     

     

     

    docker-compose ps
    

     

    or 

     

     

     

    docker ps
    

     



    You can also install FileBrowser with a single command without using docker compose.

     

     

    docker run -v /:/srv -v /root/filebrowser/datbase/filebrowser.db:/database/filebrowser.db -e PUID=0 -e PGID=0 -p 9090:80 -d filebrowser/filebrowser:s6


    To view the logs, use the command 

    docker logs -f filebrowser
    



     

    Now you can use your server's IP and the port you specified, in this case, 9090, to connect to the web interface. 

    For authorization use:
    login: admin
    password: admin




     

    Enjoy using it. 

    We also suggest considering other useful articles: