{"id":81,"date":"2023-08-05T07:33:31","date_gmt":"2023-08-05T07:33:31","guid":{"rendered":"http:\/\/it4home.dk\/?p=81"},"modified":"2023-08-06T09:18:52","modified_gmt":"2023-08-06T09:18:52","slug":"running-ghost-blog-with-docker-in-development-mode","status":"publish","type":"post","link":"https:\/\/it4home.dk\/index.php\/2023\/08\/05\/running-ghost-blog-with-docker-in-development-mode\/","title":{"rendered":"Running Ghost Blog with Docker in Development Mode"},"content":{"rendered":"<div class=\"pdfprnt-buttons pdfprnt-buttons-post pdfprnt-top-right\"><a href=\"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/81?print=pdf\" class=\"pdfprnt-button pdfprnt-button-pdf\" target=\"_blank\" ><\/a><a href=\"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/81?print=print\" class=\"pdfprnt-button pdfprnt-button-print\" target=\"_blank\" ><img decoding=\"async\" src=\"https:\/\/it4home.dk\/wp-content\/plugins\/pdf-print\/images\/print.png\" alt=\"image_print\" title=\"Print Content\" \/><\/a><\/div>\n<p class=\"wp-block-paragraph\">Introduction:<br>Ghost is a popular open-source publishing platform designed for creating and managing blogs. With Docker, you can easily set up and run Ghost in a containerized environment. In this guide, we&#8217;ll show you how to run Ghost in development mode using Docker.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 1: Install Docker<br>Before proceeding, ensure you have Docker installed on your system. If you haven&#8217;t installed Docker yet, follow the official Docker installation instructions for your operating system.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 2: Run Ghost Blog Container<br>Run the following command to create and start the Ghost blog container in development mode:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -d --restart always --name ghost -p 2368:2368 -v ghost_data:\/var\/lib\/ghost\/content -e NODE_ENV=development ghost:latest<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Explanation of options used:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>-d<\/code>: Run the container in the background (detached mode).<\/li>\n\n\n\n<li><code>--restart always<\/code>: Configure the container to automatically restart if it stops unexpectedly.<\/li>\n\n\n\n<li><code>--name ghost<\/code>: Assign the name &#8220;ghost&#8221; to the container for easy management.<\/li>\n\n\n\n<li><code>-p 2368:2368<\/code>: Map port 2368 from the container to the host system. This allows you to access the Ghost blog from <code>http:\/\/localhost:2368<\/code>.<\/li>\n\n\n\n<li><code>-v ghost_data:\/var\/lib\/ghost\/content<\/code>: Create a Docker volume named &#8220;ghost_data&#8221; and mount it to the <code>\/var\/lib\/ghost\/content<\/code> directory inside the container. This volume allows you to persist Ghost blog data, including posts and images.<\/li>\n\n\n\n<li><code>-e NODE_ENV=development<\/code>: Set the environment variable <code>NODE_ENV<\/code> to &#8220;development.&#8221; This tells Ghost to run in development mode, which provides additional debugging information and enables certain development features.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Step 3: Access Ghost Blog<br>Once the Ghost blog container is running, you can access the blog by opening a web browser and navigating to <code>http:\/\/localhost:2368<\/code>. From here, you can set up and customize your Ghost blog.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 4: Clean Up (Optional)<br>If you want to stop and remove the Ghost blog container while preserving the data, use the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker stop ghost\ndocker rm ghost<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Conclusion:<br>You&#8217;ve successfully set up and run the Ghost blog in development mode using Docker. Ghost&#8217;s development mode allows you to test and experiment with your blog&#8217;s configuration and theme without affecting the production environment. Docker provides a portable and isolated environment for running Ghost, making it easy to manage and deploy your blog.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Happy blogging!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction:Ghost is a popular open-source publishing platform designed for creating and managing blogs. With Docker, you can easily set up and run Ghost in a containerized environment. In this guide, we&#8217;ll show you how&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":206,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[2],"tags":[35],"class_list":["post-81","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker","tag-ok"],"_links":{"self":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/81","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/comments?post=81"}],"version-history":[{"count":2,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/81\/revisions"}],"predecessor-version":[{"id":136,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/81\/revisions\/136"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/media\/206"}],"wp:attachment":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/media?parent=81"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/categories?post=81"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/tags?post=81"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}