Rustのsqlx+mysql+axumで簡単なTodoの表示と追加のみを行うミニサーバーをDocker上で動かしたいのですが、うまくいきません。
開発環境ではDBのみをDockerで動かしていましたが、問題なく動作しました。しかし、実行環境でapp+DBを動作させると、MySQLのログに次のように表示されてしまいます。どのように修正すればよいのか分からない状態です。助けていただけませんか?
現在の状況は以下の通りです。
ログ
✔ Container minimini_server-db-1 Recreated 7.2s ✔ Container minimini_server-app-1 Recreated 2.7s Attaching to app-1, db-1 db-1 | 2024-07-29 14:42:38+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.39-1.el9 started. db-1 | 2024-07-29 14:42:38+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' db-1 | 2024-07-29 14:42:38+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.39-1.el9 started. db-1 | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock' db-1 | 2024-07-29T14:42:39.076574Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead. db-1 | 2024-07-29T14:42:39.079308Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.39) starting as process 1 db-1 | 2024-07-29T14:42:39.104690Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. app-1 | minimini_server: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory app-1 exited with code 127 db-1 | 2024-07-29T14:42:47.060449Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. db-1 | 2024-07-29T14:42:51.337683Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. db-1 | 2024-07-29T14:42:51.337764Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. db-1 | 2024-07-29T14:42:51.420835Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. db-1 | 2024-07-29T14:42:51.445847Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock db-1 | 2024-07-29T14:42:51.446114Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.39' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL. Gracefully stopping... (press Ctrl+C again to force)
.env
MYSQL_ROOT_PASSWORD=1234 MYSQL_DATABASE=minimini MYSQL_USER=asobi MYSQL_PASSWORD=5678 # DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@127.0.0.1:3306/${MYSQL_DATABASE}
Dockerfile.prod
FROM rust:1.80 AS builder WORKDIR /usr/src/app COPY . . ENV SQLX_OFFLINE=true RUN cargo build # FROM debian:buster-slim RUN apt-get update && apt-get install -y libssl-dev ca-certificates && rm -rf /var/lib/apt/lists/* COPY --from=builder /usr/src/app/target/debug/minimini_server /usr/local/bin/minimini_server EXPOSE 3000 CMD [ "minimini_server" ]
compose.prod.yml
services: app: build: context: . dockerfile: Dockerfile.prod env_file: - ./.env ports: - "3000:3000" networks: - app-network depends_on: - db db: image: mysql:8.0 env_file: - ./.env ports: - "3306:3306" volumes: - mysql-data:/var/lib/mysql networks: - app-network volumes: mysql-data: networks: app-network: driver: bridge
回答1件
あなたの回答
tips
プレビュー