Broken images #1964

Closed
opened 2026-02-05 02:20:29 +03:00 by OVERLORD · 7 comments
Owner

Originally created by @signifysupport on GitHub (Dec 9, 2020).

I do apologise if this has been described earlier or if this is in the wrong thread. I am new to Bookstack, let alone Docker containers.

My environment is as follows:

Ubuntu 18.04.5 LTS
Docker version: 19.03.6 | API 1.40
Bookstack 0.28.0

The issue I am experiencing is this:

A few weeks ago I have set up Bookstack on my Ubuntu VM. I have done the migration steps (moving to a new server) from our Nginx|Windows environment to our new docker environment. It was all running smooth. I was able to add new images in the pages and view\edit current (migrated) pages with the images.

A few days ago, the site was down. I logged on to the Ubuntu VM and noticed the docker image has stopped. When I tried to start it, is said that there is a pending restart. I restarted my Ubuntu VM.

Since that restart, no iimages shows up in my Bookstack site (see images below. I checked that the images exists in the local path (/var/lib/docker/volumes/....../_data/images/gallery/2020-05/) and the images does exist. I have added new page\image, and it shows up.

Because I am new to this (docker | bookstack) I am a bit lost. I do have limited experience in Ubuntu. Where do I start? Can this be a caching issue on Ubuntu\docker?

image

Originally created by @signifysupport on GitHub (Dec 9, 2020). I do apologise if this has been described earlier or if this is in the wrong thread. I am new to Bookstack, let alone Docker containers. My environment is as follows: > Ubuntu 18.04.5 LTS > Docker version: 19.03.6 | API 1.40 > Bookstack 0.28.0 The issue I am experiencing is this: A few weeks ago I have set up Bookstack on my Ubuntu VM. I have done the migration steps (moving to a new server) from our Nginx|Windows environment to our new docker environment. It was all running smooth. I was able to add new images in the pages and view\edit current (migrated) pages with the images. A few days ago, the site was down. I logged on to the Ubuntu VM and noticed the docker image has stopped. When I tried to start it, is said that there is a pending restart. I restarted my Ubuntu VM. Since that restart, no iimages shows up in my Bookstack site (see images below. I checked that the images exists in the local path (`/var/lib/docker/volumes/....../_data/images/gallery/2020-05/`) and the images does exist. I have added new page\image, and it shows up. Because I am new to this (docker | bookstack) I am a bit lost. I do have limited experience in Ubuntu. Where do I start? Can this be a caching issue on Ubuntu\docker? ![image](https://user-images.githubusercontent.com/75722239/101612844-c4793700-3a13-11eb-9aad-5ed6028948b8.png)
Author
Owner

@ssddanbrown commented on GitHub (Dec 10, 2020):

Hi @signifysupport,
Could you confirm what docker image you're using or what instructions you followed? If you have a docker-compose file or similar config that would really help us understand what you're setup looks like.

Additionally, before you go much further, make sure backup those files you found to a safe location.

@ssddanbrown commented on GitHub (Dec 10, 2020): Hi @signifysupport, Could you confirm what docker image you're using or what instructions you followed? If you have a docker-compose file or similar config that would really help us understand what you're setup looks like. Additionally, before you go much further, make sure backup those files you found to a safe location.
Author
Owner

@signifysupport commented on GitHub (Dec 10, 2020):

Thank you for the response, @ssddanbrown.

I have used the following image\instructions: https://hub.docker.com/r/solidnerd/bookstack/.

Although the instruction on this page relates to 0.29.3, I have used the 0.28.0 tag because our previous (locally hosted) version was running on that version but in a non-dockerized version.

@signifysupport commented on GitHub (Dec 10, 2020): Thank you for the response, @ssddanbrown. I have used the following image\instructions: https://hub.docker.com/r/solidnerd/bookstack/. Although the instruction on this page relates to 0.29.3, I have used the 0.28.0 tag because our previous (locally hosted) version was running on that version but in a non-dockerized version.
Author
Owner

@ssddanbrown commented on GitHub (Dec 11, 2020):

@signifysupport Okay, So you just use the docker run commands directly?

Again, Before proceeding, please backup the bookstack files you found in the /var/lib/docker/volumes directory

By the way I'm no docker pro at all, Below is based off my limited knowledge and experience with docker.

You'll need to specify some mount points in your command so that the image/file upload folders are mounted to your host system like so (Command mostly copied from linked documentation but with some volume guidance followed from here):

docker run -d --net bookstack_nw  \
-e DB_HOST=bookstack_db:3306 \
-e DB_DATABASE=bookstack \
-e DB_USERNAME=bookstack \
-e DB_PASSWORD=secret \
-p 8080:8080 \
-v /home/dan/web/docker/solidnerd/uploads_public:/var/www/bookstack/public/uploads \
-v /home/dan/web/docker/solidnerd/uploads_storage:/var/www/bookstack/storage/uploads \
 solidnerd/bookstack:0.28.3

The two lines starting with -v are the focus here.
You'll need to change the /home/dan/web/docker/solidnerd/ parts above to a location on your host system.

--

By default files are contained with the container. If you want to save stuff outside of them you'd usually have to specify it. It's also good practice to treat containers as expendable, so it does not matter if the container itself is destroyed or re-created.

Luckily the docker image used specifies a "volume" within it's configuration, hence why I think you've got the files somewhere on your system, so at least they haven't been deleted with a container. The host "volume" mount location isn't a deterministic location for when the same docker container/image is ran though. I'm guessing that when the system rebooted a new container instance was created, or at least a new volume location was used, so it's as if the files don't exist within your current docker container.

If we take one of the above command volume lines:

-v /home/dan/web/docker/solidnerd/uploads_public:/var/www/bookstack/public/uploads

This basically says: For the path /var/www/bookstack/public/uploads within the container, I want this to be mounted as /home/dan/web/docker/solidnerd/uploads_public on the host system. This means if we created the file /var/www/bookstack/public/uploads/cats.txt within the container we'd be able to see this file at the /home/dan/web/docker/solidnerd/uploads_public/cats.txt on the host system.

By mounting folders it means we can keep any data that we want to retain on the host system. That way we could then re-create the container if we wanted and the files would be in that new container like the old one, as long as we use the same mount paths.

Once you create a new bookstack container with the paths mounted, It's worth testing an image upload. You'll want to make sure the image file ends up on the mounted location on the host. If that works, you'll need to copy your images from those old volumes into those new locations. If you need help matching up old files to those new mounted locations I could help, but I'd need to know the folder structure of those old files.

You'll also want to make sure you've mounted the data for the MySQL database container (If using). If you're not sure please be careful and don't stop/destroy any containers in a panic.

@ssddanbrown commented on GitHub (Dec 11, 2020): @signifysupport Okay, So you just use the docker run commands directly? **_Again, Before proceeding, please backup the bookstack files you found in the `/var/lib/docker/volumes` directory_** _By the way I'm no docker pro at all, Below is based off my limited knowledge and experience with docker._ You'll need to specify some mount points in your command so that the image/file upload folders are mounted to your host system like so (Command mostly copied from linked documentation but with some volume guidance followed [from here](https://github.com/solidnerd/docker-bookstack#volumes)): ```shell docker run -d --net bookstack_nw \ -e DB_HOST=bookstack_db:3306 \ -e DB_DATABASE=bookstack \ -e DB_USERNAME=bookstack \ -e DB_PASSWORD=secret \ -p 8080:8080 \ -v /home/dan/web/docker/solidnerd/uploads_public:/var/www/bookstack/public/uploads \ -v /home/dan/web/docker/solidnerd/uploads_storage:/var/www/bookstack/storage/uploads \ solidnerd/bookstack:0.28.3 ``` The two lines starting with `-v` are the focus here. You'll need to change the `/home/dan/web/docker/solidnerd/` parts above to a location on your host system. -- By default files are contained with the container. If you want to save stuff outside of them you'd usually have to specify it. It's also good practice to treat containers as expendable, so it does not matter if the container itself is destroyed or re-created. Luckily the docker image used specifies a "volume" within it's configuration, hence why I think you've got the files somewhere on your system, so at least they haven't been deleted with a container. The host "volume" mount location isn't a deterministic location for when the same docker container/image is ran though. I'm guessing that when the system rebooted a new container instance was created, or at least a new volume location was used, so it's as if the files don't exist within your current docker container. If we take one of the above command volume lines: ```shell -v /home/dan/web/docker/solidnerd/uploads_public:/var/www/bookstack/public/uploads ``` This basically says: For the path `/var/www/bookstack/public/uploads` **_within the container_**, I want this to be mounted as `/home/dan/web/docker/solidnerd/uploads_public` **_on the host system_**. This means if we created the file `/var/www/bookstack/public/uploads/cats.txt` within the container we'd be able to see this file at the `/home/dan/web/docker/solidnerd/uploads_public/cats.txt` on the host system. By mounting folders it means we can keep any data that we want to retain on the host system. That way we could then re-create the container if we wanted and the files would be in that new container like the old one, as long as we use the same mount paths. Once you create a new bookstack container with the paths mounted, It's worth testing an image upload. You'll want to make sure the image file ends up on the mounted location on the host. If that works, you'll need to copy your images from those old volumes into those new locations. If you need help matching up old files to those new mounted locations I could help, but I'd need to know the folder structure of those old files. You'll also want to make sure you've mounted the data for the MySQL database container (If using). If you're not sure please be careful and don't stop/destroy any containers in a panic.
Author
Owner

@signifysupport commented on GitHub (Dec 15, 2020):

THANK YOU!

It is working now.

@signifysupport commented on GitHub (Dec 15, 2020): THANK YOU! It is working now.
Author
Owner

@ssddanbrown commented on GitHub (Dec 16, 2020):

@signifysupport Good to hear! will therefore close this off.

@ssddanbrown commented on GitHub (Dec 16, 2020): @signifysupport Good to hear! will therefore close this off.
Author
Owner

@piraterx commented on GitHub (May 23, 2023):

Sorry to open old issue but I am having same issue and I am using linuxserver.io images. I am using compose file provided in their documents.

https://github.com/linuxserver/docker-bookstack

@piraterx commented on GitHub (May 23, 2023): Sorry to open old issue but I am having same issue and I am using linuxserver.io images. I am using compose file provided in their documents. https://github.com/linuxserver/docker-bookstack
Author
Owner

@ssddanbrown commented on GitHub (May 23, 2023):

@piraterx Please open a new support issue, detailing your exact issue and environment.

@ssddanbrown commented on GitHub (May 23, 2023): @piraterx Please open a new support issue, detailing your exact issue and environment.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1964