How to change favicon in docker? #3410

Closed
opened 2026-02-05 06:37:51 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @jeffshead on GitHub (Dec 25, 2022).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

Use custom favicon. Isn't there a way to do this by adding a volume entry in the Portainer stack?

I have tried numerous lines but none work. For example:

...
 volumes:
      - /path/to/local/config:/config
      - /path/to/local/favicon.ico:/bookstack/public/favicon.ico
...
...
 volumes:
      - /path/to/local/config:/config
      - /path/to/local/favicon.ico:/public/favicon.ico
...

If I use the following, the favicon appears to have been replaced but I only get a "File not found" error on the page and I cannot access the site:

...
 volumes:
      - /path/to/local/config:/config
      - /home/docker/bookstack/favicon.ico:/app/www/public/favicon.ico
...

Exact BookStack Version

v22.11.1

Log Content

No response

PHP Version

Whatever comes with the Docker image

Hosting Environment

AlmaLinux 8.7 host, Portainer, Nginx Proxy Manager

image: lscr.io/linuxserver/bookstack
Originally created by @jeffshead on GitHub (Dec 25, 2022). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario Use custom favicon. Isn't there a way to do this by adding a volume entry in the Portainer stack? I have tried numerous lines but none work. For example: ``` ... volumes: - /path/to/local/config:/config - /path/to/local/favicon.ico:/bookstack/public/favicon.ico ... ``` ``` ... volumes: - /path/to/local/config:/config - /path/to/local/favicon.ico:/public/favicon.ico ... ``` If I use the following, the favicon appears to have been replaced but I only get a "File not found" error on the page and I cannot access the site: ``` ... volumes: - /path/to/local/config:/config - /home/docker/bookstack/favicon.ico:/app/www/public/favicon.ico ... ``` ### Exact BookStack Version v22.11.1 ### Log Content _No response_ ### PHP Version Whatever comes with the Docker image ### Hosting Environment AlmaLinux 8.7 host, Portainer, Nginx Proxy Manager ``` image: lscr.io/linuxserver/bookstack ```
OVERLORD added the 🐕 Support label 2026-02-05 06:37:51 +03:00
Author
Owner

@liuhuanshuo commented on GitHub (Jan 20, 2023):

I had a question similar to yours

https://github.com/BookStackApp/BookStack/issues/3973

I use docker to deploy the website just like you. Adding some custom content should not be done in dockerfile or docker-compose.yaml, it needs to be placed in a custom theme folder. Anyway, I implemented it

@liuhuanshuo commented on GitHub (Jan 20, 2023): I had a question similar to yours https://github.com/BookStackApp/BookStack/issues/3973 I use docker to deploy the website just like you. Adding some custom content should not be done in dockerfile or docker-compose.yaml, it needs to be placed in a custom theme folder. Anyway, I implemented it
Author
Owner

@jeffshead commented on GitHub (Jan 21, 2023):

@liuhuanshuo
Thanks for sharing. I understand the basics of how BookStack theming works but I do not see how one can change the favicon (internally) via a custom theme. I see that there is a favicon.ico in the /public directory but I do not see it referenced in any of the files under the /resources directory or referenced in any of the other files for that matter.

The only way that I have been able to change the favicon is by specifying a favicon that is hosted on a different site. I did this by adding the following line of code within the <head> tags of /themes/theme_name/layouts/base.blade.php:

<link rel="icon" href="https://www.example2.com/favicon.ico" sizes="any" type="image/x-icon">

Definitely not an ideal solution but it works.

@jeffshead commented on GitHub (Jan 21, 2023): @liuhuanshuo Thanks for sharing. I understand the basics of how BookStack theming works but I do not see how one can change the favicon (internally) via a custom theme. I see that there is a **favicon.ico** in the _/public_ directory but I do not see it referenced in any of the files under the _/resources_ directory or referenced in any of the other files for that matter. The only way that I have been able to change the favicon is by specifying a favicon that is hosted on a different site. I did this by adding the following line of code within the `<head>` tags of _/themes/theme_name/layouts/base.blade.php_: ``` <link rel="icon" href="https://www.example2.com/favicon.ico" sizes="any" type="image/x-icon"> ``` Definitely not an ideal solution but it works.
Author
Owner

@liuhuanshuo commented on GitHub (Jan 22, 2023):

Definitely not an ideal solution but it works.

You are right, replacing files is not the best solution

I searched for more related questions and finally I found the answer

https://www.reddit.com/r/BookStack/comments/xqp41o/changing_favicon/

As mentioned in the above link, we only need to add a line of code in the settings of the web version, and it works for me.

<link rel="icon" href="https://example.com/url-to-icon.png" />
@liuhuanshuo commented on GitHub (Jan 22, 2023): > Definitely not an ideal solution but it works. You are right, replacing files is not the best solution I searched for more related questions and finally I found the answer https://www.reddit.com/r/BookStack/comments/xqp41o/changing_favicon/ As mentioned in the above link, we only need to add a line of code in the settings of the web version, and it works for me. ```html <link rel="icon" href="https://example.com/url-to-icon.png" /> ```
Author
Owner

@jeffshead commented on GitHub (Jan 22, 2023):

I searched for more related questions and finally I found the answer

https://www.reddit.com/r/BookStack/comments/xqp41o/changing_favicon/

I actually tried that before posting this issue. It did not work for me when I first tried it. Since you confirmed it worked for you, I removed my override base.blade.php and tried adding that line of code in the admin settings and it worked this time! I'm guessing my browser cache did not fully clear the last time I tried it.

Still, I wish there was a simple way to use an internal image file instead of pulling the icon from an external site.

@jeffshead commented on GitHub (Jan 22, 2023): > I searched for more related questions and finally I found the answer > > https://www.reddit.com/r/BookStack/comments/xqp41o/changing_favicon/ I actually tried that before posting this issue. It did not work for me when I first tried it. Since you confirmed it worked for you, I removed my override __base.blade.php__ and tried adding that line of code in the admin settings and it worked this time! I'm guessing my browser cache did not fully clear the last time I tried it. Still, I wish there was a simple way to use an internal image file instead of pulling the icon from an external site.
Author
Owner

@jeffshead commented on GitHub (Jan 24, 2023):

So here is how I am currently using an internal image:

  1. Manually upload the favicon image file to the same directory as your custom logo.
    1. My host path: /.../config/www/uploads/images/system/2022-12/favicon.svg
    2. The resulting URL: https://example.com/uploads/images/system/2022-12/favicon.svg
  2. Add this line to the Settings->Customization->Custom HTML Head Content input box in the BookStack admin:
    1. <link rel="icon" href="uploads/images/system/2022-12/favicon.svg" sizes="any" type="image/svg+xml">

Anyone, please feel free to comment if there is a better way.

@jeffshead commented on GitHub (Jan 24, 2023): So here is how I am currently using an internal image: 1. Manually upload the favicon image file to the same directory as your custom logo. 1. My host path: _/.../config/www/uploads/images/system/2022-12/favicon.svg_ 1. The resulting URL: `https://example.com/uploads/images/system/2022-12/favicon.svg` 1. Add this line to the _Settings->Customization->Custom HTML Head Content_ input box in the BookStack admin: 1. `<link rel="icon" href="uploads/images/system/2022-12/favicon.svg" sizes="any" type="image/svg+xml">` Anyone, please feel free to comment if there is a better way.
Author
Owner

@ssddanbrown commented on GitHub (Jan 25, 2023):

@jeffshead Glad to see you found a solution.

I've just merged in #3994, to be part of the next release, so that png-based favicon can be set directly from the settings in the same way as the app logo.

@ssddanbrown commented on GitHub (Jan 25, 2023): @jeffshead Glad to see you found a solution. I've just merged in #3994, to be part of the next release, so that png-based favicon can be set directly from the settings in the same way as the app logo.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3410