0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

コンテナ(Rails)からホスト(MySQL)への通信

Last updated at Posted at 2025-05-11

DockerコンテナでRailsアプリを稼働させている。
ホスト(RHEL8)にMySQLをインストールしているので、通信できるようにしたい。
以下設定で疎通可能になる。

  • database.ymlのhost
host: host.docker.internal
  • コンテナ起動時に--add-host=host.docker.internal:host-gateway のオプションを指定
docker run --add-host=host.docker.internal:host-gateway
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?