M1 Mac DockerでPostgreSQLを起動する

Dockerはインストール済

Docker HubにPosgreSQLのイメージを確認
postgres - Official Image | Docker Hub
The PostgreSQL object-relational database system provides reliability and data integrity.
Dockerコンテナをインストールおよび起動
$ docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
Unable to find image 'postgres:latest' locally
latest: Pulling from library/postgres
15cb40b9c4df: Already exists
221f3e6640ec: Pull complete
7a55c12fb42a: Pull complete
838886d448d1: Pull complete
07f3fb9ac3a6: Pull complete
86cbbf88ba2a: Pull complete
646729a29fe5: Pull complete
d577509b5e18: Pull complete
169e5fbd7837: Pull complete
6c69887b4e59: Pull complete
bd8c3c8e58e9: Pull complete
9a21966dd3ae: Pull complete
c5ae97fd6280: Pull complete
20dc9b3942fc: Pull complete
Digest: sha256:61d5d8ef6cb4e2035f053f26b6b455c201a809354084cc8426b6904b8dd35602
Status: Downloaded newer image for postgres:latest
a68fe5be9ad612d5ea1522f3db9e7fd3a1496ab520fb2e43cda8dd6377829546

Dokcerコンテナに入る

% docker exec some-postgres -it /bin/bash
# psql -U postgres
postgres=# select version();
                                                        version
------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 13.2 (Debian 13.2-1.pgdg100+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
(1 row)

コメント

タイトルとURLをコピーしました