-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
447 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM postgres:15 | ||
|
||
RUN apt-get update && apt-get install -y postgresql-15-postgis | ||
|
||
CMD ["/usr/local/bin/docker-entrypoint.sh","postgres"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
version: '3.8' | ||
services: | ||
db: | ||
container_name: pg_container | ||
# image: postgres | ||
build: | ||
context: . | ||
dockerfile: Dockerfile-db | ||
restart: always | ||
environment: | ||
POSTGRES_USER: root | ||
POSTGRES_PASSWORD: root | ||
POSTGRES_DB: test_db | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- ./db:/docker-entrypoint-initdb.d/ | ||
- ./db.sql:/docker-entrypoint-initdb.d/init-ddl.sql | ||
- ./db.sql:/docker-entrypoint-initdb.d/init-data.sql | ||
- database_volume:/var/lib/postgresql/data | ||
pgadmin: | ||
container_name: pgadmin4_container | ||
image: dpage/pgadmin4 | ||
restart: always | ||
environment: | ||
PGADMIN_DEFAULT_EMAIL: [email protected] | ||
PGADMIN_DEFAULT_PASSWORD: root | ||
ports: | ||
- "5050:80" | ||
|
||
volumes: | ||
database_volume: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# docker readme | ||
|
||
> 도커 컴포즈로 개발DB 올리는 방법을 소개합니다! | ||
`docker-compose.yml` 디렉토리에서 명령어를 실행한다. | ||
```shell | ||
docker compose up | ||
``` | ||
|
||
- pgadmin은 `localhost:5050`처럼 로컬호스트로 접속한다. | ||
- pgadmin에서 db에 접속할때는 아래 명령어로 IP를 확인한다. | ||
```shell | ||
docker ps | grep pg_container | awk '{print $1}' | ||
docker inspect af84 | grep IPAddress | ||
``` | ||
|
||
postgis등 관련 라이브러리 설치를 위해 도커 빌드파일을 구성해줬다. | ||
```text | ||
FROM postgres:14.1 | ||
RUN apt-get update && apt-get install -y postgresql-14-postgis-3 | ||
CMD ["/usr/local/bin/docker-entrypoint.sh","postgres"] | ||
``` | ||
|
||
또는, 도커가 올라오면 터미널에 직접 붙어서 설치해줘도 된다. | ||
```shell | ||
apt-get update && apt-get install -y postgresql-14-postgis-3 | ||
``` |
Empty file.
Oops, something went wrong.