I’m trying to set up a development server for Ghost using docker-compose.
My docker-compose.yml
file is as follows:
version: "3.7"
services:
ghost:
image: ghost:4.5
container_name: ghost-dev
restart: unless-stopped
depends_on:
- db
ports:
- 2368:2368
environment:
# see https://ghost.org/docs/config/#configuration-options
database__client: mysql
database__connection__host: db
database__connection__user: ${MYSQL_USER}
database__connection__password: ${MYSQL_PASSWORD}
database__connection__database: ${MYSQL_DATABASE}
url: http://localhost:2368
NODE_ENV: development
volumes:
- ghost_content:/var/lib/ghost/content
db:
image: mysql:8
container_name: ghost-dev-db
command: mysqld --default-authentication-plugin=mysql_native_password
restart: unless-stopped
ports:
- 3307:3306
environment:
# see https://hub.docker.com/_/mysql
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
volumes:
- mysql_ghost_data:/var/lib/msql
volumes:
mysql_ghost_data:
ghost_content:
The .env
file next to the above file is as follows:
MYSQL_USER=ghost
MYSQL_ROOT_PASSWORD=12345
MYSQL_DATABASE=ghost_db
MYSQL_PASSWORD=100
Everytime I try to boot up, mysql runs but I get the following error from the ghost server:
ghost-dev | [2021-05-12 19:08:37] INFO Ghost is running in development...
ghost-dev | [2021-05-12 19:08:37] INFO Listening on: 0.0.0.0:2368
ghost-dev | [2021-05-12 19:08:37] INFO Url configured as: http://localhost:2368/
ghost-dev | [2021-05-12 19:08:37] INFO Ctrl+C to shut down
ghost-dev | [2021-05-12 19:08:37] INFO Ghost server started in 0.524s
ghost-dev | /var/lib/ghost/versions/4.5.0/node_modules/mysql/lib/protocol/Parser.js:437
ghost-dev | throw err; // Rethrow non-MySQL errors
ghost-dev | ^
ghost-dev |
ghost-dev | TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received type number (100)
ghost-dev | at Function.from (buffer.js:333:9)
ghost-dev | at Object.Auth.token (/var/lib/ghost/versions/4.5.0/node_modules/mysql/lib/protocol/Auth.js:41:29)
ghost-dev | at Handshake._sendCredentials (/var/lib/ghost/versions/4.5.0/node_modules/mysql/lib/protocol/sequences/Handshake.js:98:14)
ghost-dev | at Handshake.HandshakeInitializationPacket (/var/lib/ghost/versions/4.5.0/node_modules/mysql/lib/protocol/sequences/Handshake.js:80:10)
ghost-dev | at Protocol._parsePacket (/var/lib/ghost/versions/4.5.0/node_modules/mysql/lib/protocol/Protocol.js:291:23)
ghost-dev | at Parser._parsePacket (/var/lib/ghost/versions/4.5.0/node_modules/mysql/lib/protocol/Parser.js:433:10)
ghost-dev | at Parser.write (/var/lib/ghost/versions/4.5.0/node_modules/mysql/lib/protocol/Parser.js:43:10)
ghost-dev | at Protocol.write (/var/lib/ghost/versions/4.5.0/node_modules/mysql/lib/protocol/Protocol.js:38:16)
ghost-dev | at Socket.<anonymous> (/var/lib/ghost/versions/4.5.0/node_modules/mysql/lib/Connection.js:88:28)
ghost-dev | at Socket.<anonymous> (/var/lib/ghost/versions/4.5.0/node_modules/mysql/lib/Connection.js:526:10)
ghost-dev | at Socket.emit (events.js:315:20)
ghost-dev | at addChunk (internal/streams/readable.js:309:12)
ghost-dev | at readableAddChunk (internal/streams/readable.js:284:9)
ghost-dev | at Socket.Readable.push (internal/streams/readable.js:223:10)
ghost-dev | at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
ghost-dev | code: 'ERR_INVALID_ARG_TYPE'
ghost-dev | }
ghost-dev exited with code 1
This seems to be related to nodejs but I can’t fathom what the root cause is or how I can handle it.
Any help is appreciated. Thank you for you time.