Restart ghost blog running inside Docker

I’m using the Official Ghost Docker Image, and have ghost running without a problem.

I am developing a theme locally on the host, which is mounted as a volume inside the container. As with any running ghost instance, in order to see the theme changes, I need to stop and restart ghost.

  • Installing new gentoo kernel in docker container
  • Kafka log directories in Docker
  • Dockerize stack: MapServer - AngularJs web app - Lumen API - PostgreSQL
  • Application served by uWSGI with Supervisord from Docker
  • What environment variables can be used with a Docker image?
  • Docker and nodemcu-build. Excited but unable to run it
  • Normally this would simply mean ending the Node process and running npm start again. But inside the official Docker image, this is not an option. If I try and run npm start, I’m told:

    ERROR: (EADDRINUSE) Cannot start Ghost.

    which makes sense, as the port is already in use.

    I’ve tried manually killing the processes with no success. If I kill the node process with

    kill -9 *node process ID*

    The container crashes out. I’ve tried also killing the npm process, but this never seems to go down.

    Any ideas?

  • Docker - check private registry image version
  • Mailkit service running inside docker fails
  • Dockerhub automated build: BitBucket repository with private submodules
  • Error using akka remoting with artery over docker instances
  • Docker macvlan network cannot connect to the gateway
  • Why is 'fig build' returning: AttributeError: 'WrappedSocket' object has no attribute 'recvfrom'?
  • One Solution collect form web for “Restart ghost blog running inside Docker”

    This is how i deploy my ghost blog docker:

    docker run --name some-blog -d -p 80:2368 -e VIRTUAL_HOST=domain.com -v /home/ghost/blogfiles/:/var/lib/ghost --restart unless-stopped ghost

    The --restart unless-stopped is useful for when docker containers randomly crash. It will automatically restart them.

    Now for your question, list your docker containers by doing a docker ps you should get something like this:

    CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS              PORTS                                            NAMES
    11d2517205de        ghost                    "/entrypoint.sh npm s"   2 hours ago         Up About a minute   0.0.0.0:80->2368/tcp                             some-blog
    

    To restart the docker container you can either do docker stop [container id] and docker start [container id] or simply docker restart [container id].

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.