I have a docker file callflow_database/dockerfile
like this:
FROM mysql:8.2.0
WORKDIR /db
COPY init.sql /docker-entrypoint-initdb.d/
# Update my.cnf for more detailed error logging
RUN sed -i 's/bind-address\s*=\s*127\.0\.0\.1/bind-address = 0.0.0.0/' /etc/my.cnf && \
sed -i '/^#\s*log_error/s/^# //' /etc/my.cnf || \
echo "log_error = /var/log/mysql/error.log" >> /etc/my.cnf
and a docker compose file like this:
callflow_database:
container_name: callflow_database
ports:
- 3307:3306
restart: unless-stopped
healthcheck:
test: ["...."]
timeout: 20s
interval: 30s
start_period: 300s
retries: 5
build: ./callflow_database
When i run it with docker compose. It run normally. But when i try to push the image to docker hub and rebuild it again with another compose_production.yaml
file like this:
callflow_database:
image: yukari268/primasbot:callflow_database_JAN
container_name: callflow_database
ports:
- 3307:3306
restart: unless-stopped
healthcheck:
test: ["..."]
timeout: 20s
interval: 30s
start_period: 300s
retries: 5
I got this error:
callflow_database | 2024-01-19T04:54:10.518204Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
callflow_database | 2024-01-19T04:54:10.518213Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
callflow_database | 2024-01-19T04:54:10.524279Z 0 [ERROR] [MY-010119] [Server] Aborting