Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 1 year has passed since last update.

Pythonのコンテナからpostgres用のクライアントを入れて接続する

Last updated at Posted at 2022-09-11

実行

docker run -it --add-host=host.docker.internal:host-gateway python bash

debian系の場合(デフォルトだとdebianのはず ※2022/09時点)

コンテナ内にて、

apt -y update && apt -y upgrade
apt install -y postgresql-13  # 13の部分は必要なバージョン値に変える

で、

psql -h host.docker.internal -U postgres

公式

リンク

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?