How to install ghost with mysql and ssl in docker?

I just created a docker file but whenever i run this docker compose file i get error . database is not connecting each other with docker ghost container or its never get install with database. dockerized ghost container getting error with mysql database . here is the docker file i made

version: '3.1'

services:
 ghost:
      image: ghost:latest
      container_name: ghost
      restart: always
      ports:
      - 2368:2368
      environment:
      # see https://docs.ghost.org/docs/config#section-running-ghost-with-config-env-variables
        database__client: mysql
        database__connection__host: db
        database__connection__user: ghost
        database__connection__password: password
        database__connection__database: ghost
        GHOST_HOST: sub.techie.today
        VIRTUAL_HOST: sub.techie.today
        LETSENCRYPT_HOST: sub.techie.today
        LETSENCRYPT_EMAIL: web@sub.techie.today
      depends_on:
      - ghostdb

 ghostdb:
      image: mariadb:latest
      container_name: ghostdb
      restart: always
      environment:
        MYSQL_ROOT_PASSWORD: password
        MYSQL_USER: ghost
        MYSQL_PASSWORD: password
        MYSQL_DATABASE: ghost

networks:
    default:
       external:
         name: webproxy

Am trying to create with docker but whenever i do that deploying everything okay but its not working . when i debug docker i can see mysql is not connecting to ghost docker . docker logs --tail 50 --follow --timestamps ghost output is

2019-02-23T07:38:05.127234468Z NAME: DatabaseError
2019-02-23T07:38:05.127253008Z CODE: ENOTFOUND
2019-02-23T07:38:05.127258325Z MESSAGE: Invalid database host.
2019-02-23T07:38:05.127262748Z 
2019-02-23T07:38:05.127266883Z level:normal
2019-02-23T07:38:05.127271270Z 
2019-02-23T07:38:05.127275440Z "Please double check your database config."
2019-02-23T07:38:05.127279900Z DatabaseError: Invalid database host.
2019-02-23T07:38:05.127284257Z     at DatabaseError.KnexMigrateError (/var/lib/ghost/versions/2.15.0/node_modules/knex-migrator/lib/errors.js:7:26)
2019-02-23T07:38:05.127289754Z     at new DatabaseError (/var/lib/ghost/versions/2.15.0/node_modules/knex-migrator/lib/errors.js:56:26)
2019-02-23T07:38:05.127296828Z     at connection.raw.catch (/var/lib/ghost/versions/2.15.0/node_modules/knex-migrator/lib/database.js:33:23)
2019-02-23T07:38:05.127301045Z     at tryCatcher (/var/lib/ghost/versions/2.15.0/node_modules/bluebird/js/release/util.js:16:23)
2019-02-23T07:38:05.127305373Z     at Promise._settlePromiseFromHandler (/var/lib/ghost/versions/2.15.0/node_modules/bluebird/js/release/promise.js:512:31)
2019-02-23T07:38:05.127309660Z     at Promise._settlePromise (/var/lib/ghost/versions/2.15.0/node_modules/bluebird/js/release/promise.js:569:18)
2019-02-23T07:38:05.127313973Z     at Promise._settlePromise0 (/var/lib/ghost/versions/2.15.0/node_modules/bluebird/js/release/promise.js:614:10)
2019-02-23T07:38:05.127318430Z     at Promise._settlePromises (/var/lib/ghost/versions/2.15.0/node_modules/bluebird/js/release/promise.js:690:18)
2019-02-23T07:38:05.127334535Z     at _drainQueueStep (/var/lib/ghost/versions/2.15.0/node_modules/bluebird/js/release/async.js:138:12)
2019-02-23T07:38:05.127338612Z     at _drainQueue (/var/lib/ghost/versions/2.15.0/node_modules/bluebird/js/release/async.js:131:9)
2019-02-23T07:38:05.127342467Z     at Async._drainQueues (/var/lib/ghost/versions/2.15.0/node_modules/bluebird/js/release/async.js:147:5)
2019-02-23T07:38:05.127346359Z     at Immediate.Async.drainQueues (/var/lib/ghost/versions/2.15.0/node_modules/bluebird/js/release/async.js:17:14)
2019-02-23T07:38:05.127350219Z     at runCallback (timers.js:810:20)
2019-02-23T07:38:05.127353952Z     at tryOnImmediate (timers.js:768:5)
2019-02-23T07:38:05.127357752Z     at processImmediate [as _immediateCallback] (timers.js:745:5)

How to make it possible with docker file ? anyone please help me ?

You’ve set the value of the database host to db - should it not match the the name ghostdb, which you have specified for your database container?

Take a look at this post about networking in docker-compose Networking in Compose | Docker Docs

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.