Where is my blog saved?

I installed Ghost using the code below. When I start my container, a folder with “Content” is created in the same directory. But this is empty. So where can I access all my files?

version: '3.1'

services:

  ghost-benedikt:
    image: ghost:latest
    restart: always
    ports:
      - 2368:2368
    environment:
      # see https://ghost.org/docs/config/#configuration-options
      database__client: mysql
      database__connection__host: db
      database__connection__user: root
      database__connection__password: example
      database__connection__database: ghost-benedikt
      # this url value is just an example, and is likely wrong for your environment!
      url: https://benedikt.xn--schchner-2za.de
      # contrary to the default mentioned in the linked documentation, this image defaults to NODE_ENV=production (so development mode needs to be explicitly specified if desired)
      #NODE_ENV: development
    volumes:
      - /home/schaechner/ghost-benedikt/content/:/var/lib/ghost-benedikt/content
      - /home/schaechner/ghost-benedikt/config.production.json:/var/lib/ghost-benedikt/config.production.json

  db:
    image: mysql:8.0
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example
    volumes:
      - db:/var/lib/mysql

volumes:
  ghost-benedikt:
  db:

The right side of this volume mapping is a path inside the container that you don’t control and can’t customize. This doesn’t work because /var/lib/ghost-benedikt/content doesn’t exist inside the container.

So what’s the correct path?

One way to find out is by looking at the Dockerfile for the Ghost image. Start with the Docker Hub page about the image and click on any tag to see the Dockerfile:

https://hub.docker.com/_/ghost/

Here’s the Dockerfile you’ll find and the line you need:

There you can see that the path to the “content” folder inside the container is /var/lib/ghost/content

While the path has been broken, your content has been stored inside the container. When you fix the path, Ghost will appear empty, or rather it will container whatever content you mounted from the host.

A separate web search will help answer how to access the files within a Docker container.