
다음 사양으로 VirtualBox의 Ubuntu 18.04에 Docker와 Bitbucket을 설치했습니다.
docker run \
-e JDBC_DRIVER=org.postgresql.Driver \
-e JDBC_USER=bitbucket \
-e JDBC_PASSWORD=bitbucket \
-e JDBC_URL=jdbc:postgresql://192.168.56.139:5432/bitbucket \
-v /data/bitbucket-shared:/var/atlassian/application-data/bitbucket \
--name="bitbucket" \
-d -p 7990:7990 -p 7999:7999 \
atlassian/bitbucket-server
현재 Postgresql을 설치하고 bitbucket에 대한 데이터베이스와 사용자 이름을 만들었습니다. pg_hba.conf에 다음 줄을 추가했습니다.
host all all 127.0.0.1/32 md5
host all all 192.168.56.139/32 md5
host all all 172.17.0.2/32 md5
거기에 컨테이너 IP 주소를 추가해야 할지 잘 모르겠지만 어쨌든 추가했습니다. postgresql.conf에서 다음 줄을 편집했습니다.
listen_address = '*'
컨테이너가 시작된 후 브라우저에 다음과 같은 오류 메시지가 나타납니다.
The database, as currently configured, is not accessible.
Connection to 192.168.56.139:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
이 VM에는 iptables 규칙이 설정되어 있지 않습니다. 하지만 데이터베이스에 액세스할 수 없다는 메시지가 나타납니다.
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy DROP)
target prot opt source destination
DOCKER-USER all -- anywhere anywhere
DOCKER-ISOLATION-STAGE-1 all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain DOCKER (2 references)
target prot opt source destination
ACCEPT tcp -- anywhere 172.17.0.2 tcp dpt:7999
ACCEPT tcp -- anywhere 172.17.0.2 tcp dpt:7990
Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target prot opt source destination
DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere
DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere
RETURN all -- anywhere anywhere
Chain DOCKER-ISOLATION-STAGE-2 (2 references)
target prot opt source destination
DROP all -- anywhere anywhere
DROP all -- anywhere anywhere
RETURN all -- anywhere anywhere
Chain DOCKER-USER (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere
telnet 192.168.56.139 5432
Trying 192.168.56.139...
telnet: Unable to connect to remote host: Connection refused
무엇이 될 수 있는지 아시나요?
고마워요, 조지