質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
docker-compose

docker-composeとは、複数のコンテナで構成されるサービスを提供する手順を自動的し管理を簡単にするツール。composeファイルを使用しコマンド1回で設定した全サービスを作成・起動することが可能です。

MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

データベース

データベースとは、データの集合体を指します。また、そのデータの集合体の共用を可能にするシステムの意味を含めます

データベース設計

データベース設計はデータベースの論理的や物理的な部分を特定する工程です。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

Q&A

1回答

9949閲覧

Dockerでsqlが立ち上がらない

miiiiiiiiisan

総合スコア0

docker-compose

docker-composeとは、複数のコンテナで構成されるサービスを提供する手順を自動的し管理を簡単にするツール。composeファイルを使用しコマンド1回で設定した全サービスを作成・起動することが可能です。

MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

データベース

データベースとは、データの集合体を指します。また、そのデータの集合体の共用を可能にするシステムの意味を含めます

データベース設計

データベース設計はデータベースの論理的や物理的な部分を特定する工程です。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

0グッド

0クリップ

投稿2021/11/08 14:27

編集2022/01/12 10:55

こんにちわ。以下の動画を見ながらDockerの開発環境を実装していたのですが
この動画の1:55:01の箇所で「 docker-compose run web rails db:create」を実行したのですが
以下のようなエラーが発生します。再起動したりデータベース名を確認したのですが誤りはありませんでした。
ログを見るとプラグインテーブルが開けないとありますがイマイチよくわかりません。どうしたらいいでしょう。
もし足りない情報があればご教示おねがいします

<URL> https://youtu.be/lZD1MIHwMBY
docker-compose.yml version: '3' services: db: image: mysql:8.0 command: --default-authentication-plugin=mysql_native_password volumes: - ./src/db/mysql_data:/var/lib/mysql environment: MYSQL_PASSWORD: password web: build: . command: bundle exec rails s -p 3000 -b '0.0.0.0' volumes: - ./src:/app ports: - "3000:3000" depends_on: - db
database.yml # MySQL. Versions 5.5.8 and up are supported. # # Install the MySQL driver # gem install mysql2 # # Ensure the MySQL gem is defined in your Gemfile # gem 'mysql2' # # And be sure to use new-style password hashing: # https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html # default: &default adapter: mysql2 encoding: utf8mb4 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> username: root password: password host: db development: <<: *default database: app_development # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default database: app_test # As with config/credentials.yml, you never want to store sensitive information, # like your database password, in your source code. If your source code is # ever seen by anyone, they now have access to your database. # # Instead, provide the password or a full connection URL as an environment # variable when you boot the app. For example: # # DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase" # # If the connection URL is provided in the special DATABASE_URL environment # variable, Rails will automatically merge its configuration values on top of # the values provided in this file. Alternatively, you can specify a connection # URL environment variable explicitly: # # production: # url: <%= ENV['MY_APP_DATABASE_URL'] %> # # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database # for a full overview on how database connection configuration can be specified. # production: <<: *default database: app_production username: app password: <%= ENV['APP_DATABASE_PASSWORD'] %>
エラー Unknown MySQL server host 'db' (-3) Couldn't create 'app_development' database. Please check your configuration. rails aborted! ActiveRecord::ConnectionNotEstablished: Unknown MySQL server host 'db' (-3) /app/bin/rails:5:in `<top (required)>' /app/bin/spring:10:in `block in <top (required)>' /app/bin/spring:7:in `tap' /app/bin/spring:7:in `<top (required)>' Caused by: Mysql2::Error::ConnectionError: Unknown MySQL server host 'db' (-3) /app/bin/rails:5:in `<top (required)>' /app/bin/spring:10:in `block in <top (required)>' /app/bin/spring:7:in `tap' /app/bin/spring:7:in `<top (required)>' Tasks: TOP => db:create (See full trace by running task with --trace)
ログ 2021-11-08T14:15:21.148352Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead. 2021-11-08T14:15:21.148369Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.27) starting as process 1 2021-11-08T14:15:21.163134Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive 2021-11-08T14:15:21.189751Z 0 [Warning] [MY-000054] [Server] World-writable config file '/var/lib/mysql/auto.cnf' is ignored. 2021-11-08T14:15:21.192301Z 0 [Warning] [MY-010107] [Server] World-writable config file '/var/lib/mysql/auto.cnf' has been removed. 2021-11-08T14:15:21.192990Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 4ec113a1-409e-11ec-a254-0242ac130002. 2021-11-08T14:15:21.209684Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2021-11-08T14:15:21.701113Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. mysqld: Table 'mysql.plugin' doesn't exist 2021-11-08T14:15:21.795231Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure. 2021-11-08T14:15:21.795376Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-08T14:15:21.795497Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-08T14:15:21.795655Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-08 14:15:20+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started. 2021-11-08 14:15:20+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' 2021-11-08 14:15:20+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started. 2021-11-08T14:15:21.795815Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-08T14:15:21.795919Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-08T14:15:21.796025Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-08T14:15:21.796149Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-08T14:15:21.822573Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2021-11-08T14:15:21.895318Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2021-11-08T14:15:21.901401Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main 2021-11-08T14:15:21.901427Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main 2021-11-08T14:15:21.901668Z 0 [Warning] [MY-013595] [Server] Failed to initialize TLS for channel: mysql_main. See below for the description of exact issue. 2021-11-08T14:15:21.901693Z 0 [Warning] [MY-010069] [Server] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key 2021-11-08T14:15:21.903864Z 0 [Warning] [MY-010284] [Server] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work. 2021-11-08T14:15:21.905031Z 0 [Warning] [MY-010284] [Server] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work. 2021-11-08T14:15:21.907863Z 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. 2021-11-08T14:15:21.908061Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-08T14:15:21.908183Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist 2021-11-08T14:15:21.908211Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition. 2021-11-08T14:15:21.908488Z 0 [ERROR] [MY-010326] [Server] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist 2021-11-08T14:15:21.908535Z 0 [ERROR] [MY-010952] [Server] The privilege system failed to initialize correctly. For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual. 2021-11-08T14:15:21.908810Z 0 [ERROR] [MY-010119] [Server] Aborting 2021-11-08T14:15:23.395379Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.27) MySQL Community Server - GPL.
Dockerfile FROM ruby:2.7 RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ && apt-get update -qq \ && apt-get install -y nodejs yarn WORKDIR /app COPY ./src /app RUN bundle config --local set path 'vendor/bundle' \ && bundle install
[+] Running 1/1 ⠿ Container docker5-db-1 Recreated 2.7s [+] Running 1/1 ⠿ Container docker5-db-1 Started 1.2s => Booting Puma => Rails 6.1.4.1 application starting in production => Run `bin/rails server --help` for more startup options Puma starting in single mode... * Puma version: 5.5.2 (ruby 2.7.4-p191) ("Zawgyi") * Min threads: 5 * Max threads: 5 * Environment: production * PID: 1 * Listening on http://0.0.0.0:3000 Use Ctrl-C to stop

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

gentaro

2021/11/08 23:37

「SQL Server」というタグは同名のRDBMSのためのもので、質問文を見る限りあなた使おうとしているRDBMSは「MySQL」なんで、まったくもって不適切なタグ付けになってるから変更してください。
miiiiiiiiisan

2021/11/09 00:31 編集

すいません、たしかにSQL Serverは不適切でした。タグを直します、すいません。 具体的にどこを修正すればよろしいでしょうか。 よろしくおねがいします
guest

回答1

0

URLの動画を確認すると

MYSQL_PASSWORD: password

ではなく

MYSQL_ROOT_PASSWORD: password

のようです。

追記

たしかにそこが違っていたので直して実行してみたところ
このようなエラーが出ました

Unknown MySQL server host 'db' (-3)

おそらくdbコンテナが立ち上がっていない(立ち上がってすぐ落ちている)ため、webコンテナから参照できていない状態かと思われます。
まずはwebコンテナの設定をコメントアウトして、dbコンテナが立ち上がるように修正してみてはいかがでしょうか。

yml

1version: '3' 2services: 3 db: 4 image: mysql:8.0 5 command: --default-authentication-plugin=mysql_native_password 6 volumes: 7 - ./src/db/mysql_data:/var/lib/mysql 8 environment: 9 MYSQL_ROOT_PASSWORD: password 10 11 # web: 12 # build: . 13 # command: bundle exec rails s -p 3000 -b '0.0.0.0' 14 # volumes: 15 # - ./src:/app 16 # ports: 17 # - "3000:3000" 18 # depends_on: 19 # - db

追記

コマンドを打つ際dbコンテナのみを立ち上げる際はどのようなコマンドでしょうか。
すいません、こちらのようなコマンドでしょうか

docker run --name コンテナ名 -e MYSQL_ROOT_PASSWORD=secret -d mysql8.0

docker runコマンドではdocker-compose.ymlに定義されているdbコンテナは立ち上がりません。

docker-compose run コンテナ名またはdocker compose run コンテナ名を使用してください。

追記

src/db/mysql_data以下のファイルを削除してみてください。

これでも立ち上がらなければ、一旦ローカルディレクトリのマウントを外して立ち上げた上で、正常に起動したコンテナの/var/lib/mysqlをローカルの./src/db/mysql_dataにコピーしてみてください。

yml

1version: '3' 2services: 3 db: 4 image: mysql:8.0 5 command: --default-authentication-plugin=mysql_native_password 6 # volumes: 7 # - ./src/db/mysql_data:/var/lib/mysql 8 environment: 9 MYSQL_ROOT_PASSWORD: password 10 11 # web: 12 # build: . 13 # command: bundle exec rails s -p 3000 -b '0.0.0.0' 14 # volumes: 15 # - ./src:/app 16 # ports: 17 # - "3000:3000" 18 # depends_on: 19 # - db

その後、再度ローカルディレクトリをマウントし、起動できるかどうかの確認をしてみてください。

追記

いかのようなログが出力されました。正常には立ち上がっているようです。

正常に立ち上がったのであれば、正常に立ち上がった状態の/var/lib/mysqlディレクトリがコンテナ内にありますので、
コンテナが立ち上がっている状態で、以下のコマンドでコンテナ内の/var/lib/mysqlディレクトリをローカルの./src/db/mysql_dataディレクトリにコピーしてください。

bash

1docker cp [コンテナID]:/var/lib/mysql ./src/db/mysql_data

その後、docker-compose.ymlのvolumes部分のコメントアウトを外し、ローカルの./src/db/mysql_dataディレクトリを使用した状態でコンテナが立ち上がるかの確認をしてください。

http://localhost:3000を開いた際に以下のようなメッセージが出力されました

webのコンテナ設定をコメントアウトしているためかと思われます。

投稿2021/11/09 01:33

編集2021/11/17 01:33
KAOsaka

総合スコア531

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

miiiiiiiiisan

2021/11/09 02:56

コメントありがとうございます。たしかにそこが違っていたので直して実行してみたところ このようなエラーが出ました [+] Running 1/1 ⠿ Container docker3-db-1 Recreated 2.9s [+] Running 1/1 ⠿ Container docker3-db-1 Started 1.9s Unknown MySQL server host 'db' (-3) Couldn't create 'app_development' database. Please check your configuration. rails aborted! ActiveRecord::ConnectionNotEstablished: Unknown MySQL server host 'db' (-3) /app/bin/rails:5:in `<top (required)>' /app/bin/spring:10:in `block in <top (required)>' /app/bin/spring:7:in `tap' /app/bin/spring:7:in `<top (required)>' Caused by: Mysql2::Error::ConnectionError: Unknown MySQL server host 'db' (-3) /app/bin/rails:5:in `<top (required)>' /app/bin/spring:10:in `block in <top (required)>' /app/bin/spring:7:in `tap' /app/bin/spring:7:in `<top (required)>' Tasks: TOP => db:create (See full trace by running task with --trace)
KAOsaka

2021/11/09 04:12

回答追記しました。
miiiiiiiiisan

2021/11/09 06:42 編集

回答の追記ありがとうございます。私と同じエラーですね。 コマンドを打つ際dbコンテナのみを立ち上げる際はどのようなコマンドでしょうか。 すいません、こちらのようなコマンドでしょうか docker run --name コンテナ名 -e MYSQL_ROOT_PASSWORD=secret -d mysql8.0
KAOsaka

2021/11/09 06:59

回答追記しました。前回の追記で引用したエラーはmiiiiiiiiisanさんのコメントから引用したもので、こちらの環境で発生したエラーではありません。紛らわしかったですね、混乱させてしまってすみません。
miiiiiiiiisan

2021/11/09 08:48 編集

いえいえとんでもないです。以下のコマンドを実行してみたところ以下のログが出力されました。正常ではないようです docker-compose run db WARN[0000] Found orphan containers ([docker3_web_run_31bf78b57839 docker3_web_run_eda285055e31 docker3_web_run_7c6417c0031f docker3_web_run_3825a7652604 docker3_web_run_b8896d7bf212 docker3_web_run_fd06c3d07b51 docker3_web_run_c1a9bfa19962 docker3_web_run_054bd215d8f6 docker3_web_run_d576738ef67f docker3_web_run_3ba9293b1aa8]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. 2021-11-09 08:09:20+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started. 2021-11-09 08:09:20+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' 2021-11-09 08:09:20+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started. 2021-11-09T08:09:20.740714Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead. 2021-11-09T08:09:20.740730Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.27) starting as process 1 2021-11-09T08:09:20.760610Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive 2021-11-09T08:09:20.776481Z 0 [Warning] [MY-000054] [Server] World-writable config file '/var/lib/mysql/auto.cnf' is ignored. 2021-11-09T08:09:20.777343Z 0 [Warning] [MY-010107] [Server] World-writable config file '/var/lib/mysql/auto.cnf' has been removed. 2021-11-09T08:09:20.777734Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 57bd6093-4134-11ec-86bb-0242ac130002. 2021-11-09T08:09:20.785978Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2021-11-09T08:09:21.348818Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. mysqld: Table 'mysql.plugin' doesn't exist 2021-11-09T08:09:21.446330Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure. 2021-11-09T08:09:21.446556Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-09T08:09:21.446701Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-09T08:09:21.446871Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-09T08:09:21.447054Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-09T08:09:21.447179Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-09T08:09:21.447353Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-09T08:09:21.447458Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-09T08:09:21.474419Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2021-11-09T08:09:21.499124Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2021-11-09T08:09:21.505484Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main 2021-11-09T08:09:21.505511Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main 2021-11-09T08:09:21.505926Z 0 [Warning] [MY-013595] [Server] Failed to initialize TLS for channel: mysql_main. See below for the description of exact issue. 2021-11-09T08:09:21.505970Z 0 [Warning] [MY-010069] [Server] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key 2021-11-09T08:09:21.508409Z 0 [Warning] [MY-010284] [Server] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work. 2021-11-09T08:09:21.509965Z 0 [Warning] [MY-010284] [Server] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work. 2021-11-09T08:09:21.513461Z 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. 2021-11-09T08:09:21.513704Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2021-11-09T08:09:21.513842Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist 2021-11-09T08:09:21.513861Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition. 2021-11-09T08:09:21.514141Z 0 [ERROR] [MY-010326] [Server] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist 2021-11-09T08:09:21.514205Z 0 [ERROR] [MY-010952] [Server] The privilege system failed to initialize correctly. For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual. 2021-11-09T08:09:21.514501Z 0 [ERROR] [MY-010119] [Server] Aborting 2021-11-09T08:09:23.052348Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.27) MySQL Community Server - GPL.
KAOsaka

2021/11/09 08:56

src/db/mysql_data以下のファイルを削除してみてください。
miiiiiiiiisan

2021/11/09 10:18

ありがとうございます。試してみます
miiiiiiiiisan

2021/11/15 14:18 編集

src/db/mysql_data以下のファイルを削除して実行してみたところ以下のエラーが発生しました。 Traceback (most recent call last): File "docker-compose", line 3, in <module> File "compose/cli/main.py", line 81, in main File "compose/cli/main.py", line 200, in perform_command File "compose/cli/command.py", line 70, in project_from_options File "compose/cli/command.py", line 146, in get_project File "compose/cli/command.py", line 206, in get_project_name File "posixpath.py", line 383, in abspath FileNotFoundError: [Errno 2] No such file or directory [354] Failed to execute script docker-compose
miiiiiiiiisan

2021/11/15 14:18 編集

すいませんここがよくわからないです。 「ローカルディレクトリのマウントを外す」と「正常に起動したコンテナの/var/lib/mysqlをローカルの./src/db/mysql_dataにコピーしてみてください。」がわからないです... >これでも立ち上がらなければ、一旦ローカルディレクトリのマウントを外して立ち上げた上で、正常に起動したコンテナの/var/lib/mysqlをローカルの./src/db/mysql_dataにコピーしてみてください。
KAOsaka

2021/11/16 01:20

まずdocker-compose.ymlのvolumes部分をコメントアウトした状態で起動して、正常にコンテナが動くかどうか試してみてください。
miiiiiiiiisan

2021/11/16 11:04 編集

コメントありがとうございます。docker-compose.ymlのvolumes部分とwebの箇所をコメントアウトして docker-compose run dbを実行してみたところ いかのようなログが出力されました。正常には立ち上がっているようです。 しかしここからどうやってwebを実行すればいいでしょうか。コマンドラインが入力できないです WARNING: Found orphan containers (docker5_web_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. Creating docker5_db_run ... done 2021-11-16 10:58:36+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started. 2021-11-16 10:58:36+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' 2021-11-16 10:58:36+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started. 2021-11-16 10:58:36+00:00 [Note] [Entrypoint]: Initializing database files 2021-11-16T10:58:36.792347Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead. 2021-11-16T10:58:36.792353Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.27) initializing of server in progress as process 42 2021-11-16T10:58:36.798750Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2021-11-16T10:58:37.346967Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2021-11-16T10:58:38.665370Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main 2021-11-16T10:58:38.665395Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main 2021-11-16T10:58:38.750450Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option. 2021-11-16 10:58:42+00:00 [Note] [Entrypoint]: Database files initialized 2021-11-16 10:58:42+00:00 [Note] [Entrypoint]: Starting temporary server mysqld will log errors to /var/lib/mysql/2115109d9bbe.err mysqld is running as pid 93 2021-11-16 10:58:42+00:00 [Note] [Entrypoint]: Temporary server started. Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it. Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it. 2021-11-16 10:58:45+00:00 [Note] [Entrypoint]: Stopping temporary server 2021-11-16 10:58:47+00:00 [Note] [Entrypoint]: Temporary server stopped 2021-11-16 10:58:47+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up. 2021-11-16T10:58:47.550791Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead. 2021-11-16T10:58:47.550815Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.27) starting as process 1 2021-11-16T10:58:47.567391Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2021-11-16T10:58:47.693227Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2021-11-16T10:58:47.860349Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main 2021-11-16T10:58:47.860380Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main 2021-11-16T10:58:47.860857Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2021-11-16T10:58:47.860891Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2021-11-16T10:58:47.863758Z 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. 2021-11-16T10:58:47.873815Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
miiiiiiiiisan

2021/11/16 11:44

追記失礼します。あれから色々格闘したのですが 一応、サーバーを立ち上げることはできました。しかしながら http://localhost:3000を開いた際に以下のようなメッセージが出力されました The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved.
KAOsaka

2021/11/17 01:34

回答追記しました。
miiiiiiiiisan

2021/11/17 18:29

ありがとうございます。確認します
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問