{"id":1945,"date":"2025-05-08T18:14:50","date_gmt":"2023-01-20T15:47:22","guid":{"rendered":""},"modified":"2025-02-02T00:46:17","modified_gmt":"2025-02-01T23:46:17","slug":"docker-guide-deploying-ghost-blog-with-mysql-and-traefik-with-docker","status":"publish","type":"post","link":"https:\/\/netcloud24.com\/knowledgebase\/docker-guide-deploying-ghost-blog-with-mysql-and-traefik-with-docker\/","title":{"rendered":"Docker Guide: Deploying Ghost Blog with MySQL and Traefik with Docker"},"content":{"rendered":"<p>\u00a0<\/p>\n<\/p>\n<p>Ghost is a popular, open-source blogging platform that is designed for simplicity and speed. Using Docker, you can easily deploy Ghost with a MySQL database and Traefik for reverse proxying and automatic SSL management. Whether you&#8217;re hosting your blog on a  or any other server provider, this guide will walk you through the steps of setting up Ghost with MySQL and Traefik using Docker.<\/p>\n<h2>Prerequisites<\/h2>\n<p>Before starting, ensure you have the following:<\/p>\n<ul>\n<li>A server with Docker and Docker Compose installed, which can be hosted on a <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">UK Windows VPS<\/a>, <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPSVirtual Private Servers<\/a>, or another <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPS Hosting UK<\/a> solution.<\/li>\n<li>A domain name pointed to your server&#8217;s IP address.<\/li>\n<\/ul>\n<h2>Step 1: Set Up Docker Compose File<\/h2>\n<p>Create a directory for your Ghost blog setup and navigate to it:<\/p>\n<pre><code>mkdir ghost-mysql-traefik\r\ncd ghost-mysql-traefik<\/code><\/pre>\n<p>Create a <code>docker-compose.yml<\/code> file in this directory:<\/p>\n<pre><code>nano docker-compose.yml<\/code><\/pre>\n<p>Add the following configuration:<\/p>\n<pre><code>version: '3'\r\n\r\nservices:\r\n  ghost:\r\n    image: ghost:latest\r\n    container_name: ghost-blog\r\n    restart: always\r\n    depends_on:\r\n      - db\r\n    environment:\r\n      url: http:\/\/your-domain.com\r\n      database__client: mysql\r\n      database__connection__host: db\r\n      database__connection__user: ghost\r\n      database__connection__password: yourpassword\r\n      database__connection__database: ghost\r\n    volumes:\r\n      - .\/ghost\/content:\/var\/lib\/ghost\/content\r\n    labels:\r\n      - \"traefik.enable=true\"\r\n      - \"traefik.http.routers.ghost.rule=Host(`your-domain.com`)\"\r\n      - \"traefik.http.services.ghost.loadbalancer.server.port=2368\"\r\n    networks:\r\n      - ghost-network\r\n\r\n  db:\r\n    image: mysql:5.7\r\n    container_name: ghost-db\r\n    restart: always\r\n    environment:\r\n      MYSQL_ROOT_PASSWORD: yourpassword\r\n      MYSQL_DATABASE: ghost\r\n      MYSQL_USER: ghost\r\n      MYSQL_PASSWORD: yourpassword\r\n    volumes:\r\n      - .\/ghost\/db:\/var\/lib\/mysql\r\n    networks:\r\n      - ghost-network\r\n\r\n  traefik:\r\n    image: traefik:v2.3\r\n    container_name: traefik\r\n    restart: always\r\n    command:\r\n      - \"--api.insecure=true\"\r\n      - \"--providers.docker=true\"\r\n      - \"--entrypoints.web.address=:80\"\r\n      - \"--entrypoints.websecure.address=:443\"\r\n      - \"--certificatesresolvers.myresolver.acme.tlschallenge=true\"\r\n      - \"--certificatesresolvers.myresolver.acme.email=youremail@example.com\"\r\n      - \"--certificatesresolvers.myresolver.acme.storage=\/letsencrypt\/acme.json\"\r\n    ports:\r\n      - \"80:80\"\r\n      - \"443:443\"\r\n    volumes:\r\n      - \"\/var\/run\/docker.sock:\/var\/run\/docker.sock:ro\"\r\n      - \".\/letsencrypt:\/letsencrypt\"\r\n    networks:\r\n      - ghost-network\r\n\r\nnetworks:\r\n  ghost-network:\r\n    driver: bridge<\/code><\/pre>\n<p>Replace <code>your-domain.com<\/code> and <code>yourpassword<\/code> with your actual domain and password.<\/p>\n<h2>Step 2: Set Permissions for Docker Volumes<\/h2>\n<p>Ensure that the directories for Ghost content and MySQL data have the correct permissions:<\/p>\n<pre><code>mkdir -p ghost\/content ghost\/db letsencrypt\r\nsudo chown -R 1000:1000 ghost\/content ghost\/db<\/code><\/pre>\n<h2>Step 3: Launch the Docker Containers<\/h2>\n<p>Run the following command to start the Ghost, MySQL, and Traefik services:<\/p>\n<pre><code>docker-compose up -d<\/code><\/pre>\n<p>This will download the required images and set up your Ghost blog, MySQL database, and Traefik for reverse proxying and SSL management.<\/p>\n<h2>Step 4: Access Your Ghost Blog<\/h2>\n<p>Once the services are up and running, open your web browser and navigate to <code>http:\/\/your-domain.com<\/code> to access your Ghost blog. You will be greeted by the Ghost setup page, where you can create your admin account and configure your blog.<\/p>\n<h2>Step 5: Verify SSL with Traefik<\/h2>\n<p>Traefik automatically handles obtaining an SSL certificate from Let&#8217;s Encrypt for your domain. To verify that SSL is working, visit <code>https:\/\/your-domain.com<\/code> in your browser, and check that the connection is secure.<\/p>\n<h2>Conclusion<\/h2>\n<p>By following these steps, you have successfully deployed a Ghost blog with MySQL and Traefik using Docker. Whether you&#8217;re hosting your site on a , <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Microsoft SQL VPS Windows<\/a>, or another <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPSVirtual Private Server Hosting<\/a> solution, this setup ensures your Ghost blog is fast, secure, and easy to manage with Docker.<\/p>\n<footer>\n<p>For more VPS hosting options, visit . They offer a variety of <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPSVirtual Private Servers<\/a> and <a href=\"https:\/\/ie.netcloud24.com\" target=\"_blank\" rel=\"follow\">Windows VPS Hosting UK<\/a> solutions tailored to your needs.<\/p>\n<\/footer>\n<div class=\"post-author-box\" style=\"border-top:1px solid #ddd;margin-top:20px;padding-top:15px;\">\n<p><strong>Author:<\/strong> \u0141ukasz Bodziony<\/p>\n<p><strong>Website:<\/strong> <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a><\/p>\n<p><em>\u0141ukasz Bodziony is the CEO and founder of <a href=\"https:\/\/netcloud24.com\" target=\"_blank\" rel=\"dofollow\">NETCLOUD24<\/a>, a global VPS hosting brand proudly originating from Poland. With extensive experience in cloud computing, virtualization, and server management, he delivers high-performance <strong>Windows VPS<\/strong> and <strong>Remote Desktop Services (RDS)<\/strong> solutions to clients across Europe, North America, and beyond.<\/em><\/p>\n<p><em>His expertise covers a wide range of technologies, including <strong>Microsoft Azure<\/strong>, <strong>Proxmox VE<\/strong>, <strong>Amazon Web Services (AWS)<\/strong>, and numerous other virtualization and cloud platforms.<\/em><\/p>\n<p><em>Beyond running his hosting business, \u0141ukasz also provides <strong>professional paid server configuration and optimization services<\/strong> for companies and individuals. Outside of work, he is dedicated to caring for his children and building a secure future for them.<\/em><\/p>\n<p><em>If you are interested in working with him or need expert assistance with your hosting, cloud environment, or server setup, feel free to reach out via <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a>.<\/em><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 Ghost is a popular, open-source blogging platform that is designed for simplicity and speed. Using Docker, you can easily deploy Ghost with a MySQL database and Traefik\u2026<\/p>\n","protected":false},"author":1,"featured_media":3421,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[],"tags":[14,12,11,23,20,21,22,17,7,8,6,10,18,19,15,24,16,5,13,9],"class_list":["post-1945","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-cheapvps","tag-cloudvps","tag-hostingvps","tag-rds","tag-rdscal","tag-remotedesktop","tag-remotedesktopvps","tag-servervps","tag-ukvps","tag-virtualserver","tag-vpshosting","tag-vpsserver","tag-vpssolutions","tag-vpswindows","tag-vpswithwindows","tag-windowsrds","tag-windowsserver","tag-windowsvps","tag-windowsvpshosting","tag-windowsvpsuk"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1945","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1945"}],"version-history":[{"count":0,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1945\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media\/3421"}],"wp:attachment":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}