Javascript 如何在docker中使用mariadb部署ghost?
这是我做的docker文件Javascript 如何在docker中使用mariadb部署ghost?,javascript,node.js,docker,Javascript,Node.js,Docker,这是我做的docker文件 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-co
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
我试图创建与docker,但每当我这样做,部署一切正常,但它不工作。当我调试docker时,我可以看到mysql没有连接到ghost docker
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)
如何使docker文件成为可能?有人能帮我吗?您的数据库地址不是db。改用ghostdb:
database__connection__host: ghostdb
此外,您仍然可以使用弃用的。对我有用。我使用docker compose版本1.22.0
links:
- ghostdb:db
ghost仍然在启动时出现错误。因为需要时间来开始。
您可以使用中的一些建议,在mariadb准备就绪之前避免重启动。或者创建一些命令
暂停并准备好使用后,您将看到日志:
ghost | [2019-02-23 11:08:52] INFO Creating table: posts
ghost | [2019-02-23 11:08:52] INFO Creating table: users
ghost | [2019-02-23 11:08:53] INFO Creating table: posts_authors
ghost | [2019-02-23 11:08:53] INFO Creating table: roles
ghost | [2019-02-23 11:08:53] INFO Creating table: roles_users
ghost | [2019-02-23 11:08:53] INFO Creating table: permissions
ghost | [2019-02-23 11:08:54] INFO Creating table: permissions_users
ghost | [2019-02-23 11:08:54] INFO Creating table: permissions_roles
ghost | [2019-02-23 11:08:54] INFO Creating table: permissions_apps
ghost | [2019-02-23 11:08:54] INFO Creating table: settings
ghost | [2019-02-23 11:08:54] INFO Creating table: tags
ghost | [2019-02-23 11:08:55] INFO Creating table: posts_tags
ghost | [2019-02-23 11:08:55] INFO Creating table: apps
ghost | [2019-02-23 11:08:55] INFO Creating table: app_settings
ghost | [2019-02-23 11:08:56] INFO Creating table: app_fields
ghost | [2019-02-23 11:08:56] INFO Creating table: clients
ghost | [2019-02-23 11:08:56] INFO Creating table: client_trusted_domains
ghost | [2019-02-23 11:08:56] INFO Creating table: accesstokens
ghost | [2019-02-23 11:08:57] INFO Creating table: refreshtokens
ghost | [2019-02-23 11:08:58] INFO Creating table: subscribers
ghost | [2019-02-23 11:08:58] INFO Creating table: invites
ghost | [2019-02-23 11:08:58] INFO Creating table: brute
ghost | [2019-02-23 11:08:58] INFO Creating table: webhooks
ghost | [2019-02-23 11:08:58] INFO Creating table: sessions
ghost | [2019-02-23 11:08:58] INFO Creating table: integrations
ghost | [2019-02-23 11:08:59] INFO Creating table: api_keys
ghost | [2019-02-23 11:08:59] INFO Creating table: mobiledoc_revisions
ghost | [2019-02-23 11:08:59] INFO Creating table: members
ghost | [2019-02-23 11:08:59] INFO Creating table: actions
ghost | [2019-02-23 11:08:59] INFO Model: Tag
ghost | [2019-02-23 11:08:59] INFO Model: Client
ghost | [2019-02-23 11:08:59] INFO Model: Role
ghost | [2019-02-23 11:08:59] INFO Model: Permission
ghost | [2019-02-23 11:09:00] INFO Model: User
ghost | [2019-02-23 11:09:01] INFO Model: Post
ghost | [2019-02-23 11:09:01] INFO Model: Integration
ghost | [2019-02-23 11:09:01] INFO Relation: Role to Permission
ghost | [2019-02-23 11:09:01] INFO Relation: Post to Tag
ghost | [2019-02-23 11:09:01] INFO Relation: User to Role
ghost | [2019-02-23 11:09:02] WARN Theme's file locales/en.json not found.
ghost | [2019-02-23 11:09:03] INFO Ghost is running in production...
ghost | [2019-02-23 11:09:03] INFO Your blog is now available on http://localhost:2368/
ghost | [2019-02-23 11:09:03] INFO Ctrl+C to shut down
ghost | [2019-02-23 11:09:03] INFO Ghost boot 11.672s
通常在我的机器上需要20-30秒您的数据库地址不是db。改用ghostdb:
database__connection__host: ghostdb
此外,您仍然可以使用弃用的。对我有用。我使用docker compose版本1.22.0
links:
- ghostdb:db
ghost仍然在启动时出现错误。因为需要时间来开始。
您可以使用中的一些建议,在mariadb准备就绪之前避免重启动。或者创建一些命令
暂停并准备好使用后,您将看到日志:
ghost | [2019-02-23 11:08:52] INFO Creating table: posts
ghost | [2019-02-23 11:08:52] INFO Creating table: users
ghost | [2019-02-23 11:08:53] INFO Creating table: posts_authors
ghost | [2019-02-23 11:08:53] INFO Creating table: roles
ghost | [2019-02-23 11:08:53] INFO Creating table: roles_users
ghost | [2019-02-23 11:08:53] INFO Creating table: permissions
ghost | [2019-02-23 11:08:54] INFO Creating table: permissions_users
ghost | [2019-02-23 11:08:54] INFO Creating table: permissions_roles
ghost | [2019-02-23 11:08:54] INFO Creating table: permissions_apps
ghost | [2019-02-23 11:08:54] INFO Creating table: settings
ghost | [2019-02-23 11:08:54] INFO Creating table: tags
ghost | [2019-02-23 11:08:55] INFO Creating table: posts_tags
ghost | [2019-02-23 11:08:55] INFO Creating table: apps
ghost | [2019-02-23 11:08:55] INFO Creating table: app_settings
ghost | [2019-02-23 11:08:56] INFO Creating table: app_fields
ghost | [2019-02-23 11:08:56] INFO Creating table: clients
ghost | [2019-02-23 11:08:56] INFO Creating table: client_trusted_domains
ghost | [2019-02-23 11:08:56] INFO Creating table: accesstokens
ghost | [2019-02-23 11:08:57] INFO Creating table: refreshtokens
ghost | [2019-02-23 11:08:58] INFO Creating table: subscribers
ghost | [2019-02-23 11:08:58] INFO Creating table: invites
ghost | [2019-02-23 11:08:58] INFO Creating table: brute
ghost | [2019-02-23 11:08:58] INFO Creating table: webhooks
ghost | [2019-02-23 11:08:58] INFO Creating table: sessions
ghost | [2019-02-23 11:08:58] INFO Creating table: integrations
ghost | [2019-02-23 11:08:59] INFO Creating table: api_keys
ghost | [2019-02-23 11:08:59] INFO Creating table: mobiledoc_revisions
ghost | [2019-02-23 11:08:59] INFO Creating table: members
ghost | [2019-02-23 11:08:59] INFO Creating table: actions
ghost | [2019-02-23 11:08:59] INFO Model: Tag
ghost | [2019-02-23 11:08:59] INFO Model: Client
ghost | [2019-02-23 11:08:59] INFO Model: Role
ghost | [2019-02-23 11:08:59] INFO Model: Permission
ghost | [2019-02-23 11:09:00] INFO Model: User
ghost | [2019-02-23 11:09:01] INFO Model: Post
ghost | [2019-02-23 11:09:01] INFO Model: Integration
ghost | [2019-02-23 11:09:01] INFO Relation: Role to Permission
ghost | [2019-02-23 11:09:01] INFO Relation: Post to Tag
ghost | [2019-02-23 11:09:01] INFO Relation: User to Role
ghost | [2019-02-23 11:09:02] WARN Theme's file locales/en.json not found.
ghost | [2019-02-23 11:09:03] INFO Ghost is running in production...
ghost | [2019-02-23 11:09:03] INFO Your blog is now available on http://localhost:2368/
ghost | [2019-02-23 11:09:03] INFO Ctrl+C to shut down
ghost | [2019-02-23 11:09:03] INFO Ghost boot 11.672s
通常在我的机器上需要20-30秒欢迎使用stackoverflow。这个问题与docker有关,而不是JS。使用合适的标签,让问题在合适的人面前显现出来,帮助你。欢迎来到stackoverflow。这个问题与docker有关,而不是JS。使用合适的标签,让问题在合适的人面前显现出来,帮助你。