엉 엉ㅇ 엉
이제 도커 잡은지 일이주 되가고...
도커 컴포저 사용한지 일주일 정도 되가는 초보입니다. ㅋㅋㅋ
레드마인/postgresql를 설치하려고 하는데 이게 왜 같은 도커 안에서 postgresql를 찾지를 못하는 걸까요?
docker-compose.yaml 내용은 다음과 같습니다.
version: '3.7'
services:
redmine:
image: 'redmine:latest'
ports:
- '8283:3000'
environment:
- DB_HOST=postgres
- DB_ADAPTER=postgresql
- DB_PORT=5432
- DB_NAME=redmine
- DB_USER=redmine
- DB_PASS=jwp1234!
volumes:
- '/data/data/docker/new_redmine:/home/redmine/data'
container_name: 'redmine-container_t'
postgres:
image: postgres:11
restart: always
container_name: compose-pgsql_t
volumes:
- /data/data/docker/redmine/postgresql/data:/var/lib/postgresql/data
ports:
- 25432:5432
environment:
- POSTGRES_PASSWORD=jwp1234!
- POSTGRES_DB=redmine
이렇게하면 이렇게 잘 뜨는것 같이 보입니다.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
75b00fa0e726 postgres:11 "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:25432->5432/tcp compose-pgsql_t
d52b23e81338 redmine:latest "/docker-entrypoint.…" About a minute ago Up About a minute 0.0.0.0:8283->3000/tcp redmine-container_t
하지만 실상은 postgresql과 연동된게 아니고 그냥 레드마인에 있는 기본 디비에 연결됩니다. ㅠㅠㅠㅠ
로그는 다음과 같습니다.
postgresql로그
docker logs 75b00fa0e726
PostgreSQL Database directory appears to contain a database; Skipping initialization
2020-11-06 08:43:41.158 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2020-11-06 08:43:41.158 UTC [1] LOG: listening on IPv6 address "::", port 5432
2020-11-06 08:43:41.283 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-11-06 08:43:41.475 UTC [25] LOG: database system was shut down at 2020-11-06 08:10:24 UTC
2020-11-06 08:43:41.552 UTC [1] LOG: database system is ready to accept connections
redmine로그
[root@jwpserverfaster new_redmine]# docker logs d52b23e81338 | grep post
warning: missing REDMINE_DB_MYSQL, REDMINE_DB_POSTGRES, or REDMINE_DB_SQLSERVER environment variables
*** Using sqlite3 as fallback. ***
[2020-11-06 08:44:05] INFO WEBrick 1.4.2
[2020-11-06 08:44:05] INFO ruby 2.6.6 (2020-03-31) [x86_64-linux]
[2020-11-06 08:44:05] INFO WEBrick::HTTPServer#start: pid=1 port=3000
물론 외부에 직접 설치한 postgres로 레드마인을 연동하면 잘 됩니다.
이런 저런 컴포저 파일들 참조하고 검색해서 계속해보지만 같은 도커 안에서 실행되는 postgresql로 연동이 절대~ 절대 안되네요...ㅠㅠㅠㅠㅠ
네트워크도 컴포저 화일안에 있으면 같은 네트워크 사용한다고 해서 그 문제는 아닌것 같은데...
과연 뭐가 잘못瑛뺑楮?????
정말 감사합니다.
ȯ°æº¯¼ö À̸§ÀÌ À߸øµÈ°Å °°³×¿ä
- ·¹µå¸¶ÀÎ ÄÁÅ×ÀÌ³Ê È¯°æº¯¼ö´Â ¾Æ·¡Ã³·³ µÇ¾î¾ß ÇÕ´Ï´Ù. (º¯¼ö´Â »óȲ¿¡ ¸Â°Ô ¼öÁ¤Çϼ¼¿ä)
environment:
REDMINE_DB_POSTGRES: db
REDMINE_DB_USERNAME: redmine
REDMINE_DB_DATABASE: redmine
REDMINE_DB_PASSWORD: passwd
- dbÂÊ Æ÷Æ® ¸ÅÇÎÀº »èÁ¦Çϼ¼¿ä. ÇÊ¿ä¾ø½À´Ï´Ù.
- ·¹µå¸¶ÀÎ À¥¼¹ö´Â WEBrick Àº Å×½ºÆ®¿ëÀ¸·Î¸¸ »ç¿ëÇϽðí, passenger ¾²½Ã¸é µË´Ï´Ù.
version: '3.1'
services:
redmine:
image: redmine:4.1-passenger
restart: always
container_name: redmine-psg-pg_container
ports:
- 8030:3000
volumes:
- ./files:/usr/src/redmine/files
- ./themes:/usr/src/redmine/public/themes
- ./plugins:/usr/src/redmine/plugins
environment:
REDMINE_DB_POSTGRES: db
REDMINE_DB_USERNAME: redmine
REDMINE_DB_DATABASE: redmine
REDMINE_DB_PASSWORD: passwd
db:
image: postgres:12.2-alpine
container_name: redmine-psg-pg_db
restart: always
volumes:
- ./data:/var/lib/postgresql/data
environment:
POSTGRES_DB: redmine
POSTGRES_PASSWORD: passwd
POSTGRES_USER: redmine
¾Ë·ÁÁֽŴë·Î docker-compose ÆÄÀÏÀ» ¼ÂÆÃÇÏ°í ½ÇÇàÀ» ½ÃÄ״µ¥ postgres ½ÇÇàÀÌ ¾ÈµÇ°í ¾Æ·¡¿Í °°Àº ·Î±×°¡ ÂïÈ÷³×¿ä ¤Ð¤Ð¤Ð
PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory
¶Ç´Â
PostgreSQL Database directory appears to contain a database; Skipping initialization
2020-11-07 05:07:31.926 GMT [1] LOG: skipping missing configuration file "/var/lib/postgresql/data/postgresql.auto.conf"
postgres: could not find the database system
Expected to find it in the directory "/var/lib/postgresql/data",
but could not open file "/var/lib/postgresql/data/global/pg_control": No such file or directory
À̶ó´Â ·Î±×°¡ ÂïÈ÷³×¿ä ¤Ð¤Ð
redmineÀº Àß ½ÇÇàµÇ´Âµí Çѵ¥ ¸»ÀÌÁÒ ¤§ ¤§ ¤§
¾Ë·ÁÁֽŠdocker-compose ³»¿ëÀ» »ì¦ µð·ºÅ丮¸¸ ¹Ù²å´Âµ¥...¤Ð¤Ð
version: '3.1'
services:
redmine:
image: redmine:4.1-passenger
restart: always
container_name: redmine-psg-pg_container
ports:
- 8282:3000
volumes:
- /data/data/docker/new_redmine:/usr/src/redmine/files
- /data/data/docker/new_redmine:/usr/src/redmine/public/themes
- /data/data/docker/new_redmine:/usr/src/redmine/plugins
environment:
REDMINE_DB_POSTGRES: db
REDMINE_DB_USERNAME: redmine
REDMINE_DB_DATABASE: redmine
REDMINE_DB_PASSWORD: abc1234!
db:
image: postgres:12.2-alpine
container_name: redmine-psg-pg_db
restart: always
volumes:
- /data/data/docker/new_redmine/postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_DB: redmine
POSTGRES_PASSWORD:abc1234!
POSTGRES_USER: redmine
¾Æ¹«Æ° ³Ê¹« °¨»çÇÕ´Ï´Ù.
Á» ´õ ¿¬±¸ÇغÁ¾ß°Ú³×¿ä....