Search code examples
dockerghost-blogghost

Error when running ghost docker image second time


I can run docker container with ghost with this command (https://hub.docker.com/_/ghost/):

docker run -ti -v /tmp/data:/var/lib/ghost/content -p2368:2368 ghost

But only when /tmp/data is empty. If I try to stop this container with Ctrl+c and run it again, it fails with this error:

docker run -ti -v /tmp/data:/var/lib/ghost/content -p2368:2368 ghost
chown: changing ownership of '/var/lib/ghost/content/themes/casper': No such file or directory

I need to store ghost's data outside container and this is the way based on documentation. Am I missing something?

I'm trying this on Mac.


Solution

  • I had same problem when running ghost under Docker for Mac.
    I would suggest to create docker volume for your data, rather than mounting direct folder. There seems to be a problem with resolving symlinks.

    docker volume create ghost-data
    docker run -it --mount source=ghost-data,target=/var/lib/ghost/content -p 2368:2368 ghost