Ubunt20.04.6 LTS에서 Docker postgresql서버와 Docker pgAdmin4를 설치하기

linux Linux

이 글은 아래 OS환경에서 설치했습니다.

cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
su - ubuntu
pwd
/home/ubuntu

Postgresql서버 설치하기

docker pull postgres 
mkdir /home/ubuntu/postgresql/data
docker run --name postgresql -e POSTGRES_USER=root -e POSTGRES_PASSWORD=mypassword -p 5432:5432 -v /home/ubuntu/postgresql/data:/var/lib/postgresql/data -d postgres

PgAdmin4설치하기

docker pull dpage/pgadmin4:latest
docker run --name pgadmin -p 82:80 -e 'PGADMIN_DEFAULT_EMAIL=mymail@gmail.com' -e 'PGADMIN_DEFAULT_PASSWORD=mypassword' -d dpage/pgadmin4

pgadmin4유저: mymail@gmail.com, 패스워드:root 로 다음URL의 PgAdmin4 관리화면으로 로그인합니다.

http://192.168.1.86:82

PgAdmin4 관리화면에서 PostgreSQL서버 접속하기위한 IPAddress정보는 다음 명령으로 확인합니다.

docker inspect postgresql
[
    {
        "Id": "dec42b6a478617d54c14b14ceff477cd5ff128b1955b6215760cbabdf707bed9",
        "Created": "2023-10-08T16:44:39.850355453Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "postgres"
        ],
... 중간생략 ...
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "434e35c2c34b7654f2421fb5a218d18eddcf28443e16d5b184e67c5889df613c",
                    "EndpointID": "a6a6d0e9970d3e1046c3329a6893be75d119de43f8720ee9856c9a64dc1794b6",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02",
                    "DriverOpts": null
                }
            }
... 중간생략 ...

댓글

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