어느날 홈페이지가 내려갔다..
Apache Proxy를 사용중이였는데 아무리 봐도 설정 문제는 아니였다. 그래서 ip:8080으로 Ping을 날려도 응답이 없길래 Ping Test 해봤더니 네트워크 연결이 안되고 있었다...
> /etc/httpd/conf/virtualhost.conf
<VirtualHost *:80>
ServerName velog.co.kr
ServerAlias www.velog.co.kr
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://ip:8080/
ProxyPassReverse / http://ip:8080/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
Docker 내부 -> 외부 통신이 안되는것 확인.
sh-4.2# ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
--- 1.1.1.1 ping statistics ---
41 packets transmitted, 0 received, 100% packet loss, time 39999ms
조치사항
#### Before :
docker run -it --publish 80:80 -d --privileged --name apache centos:7 '/sbin/init'
#### After :
docker run -it --network host -d --privileged --name apache centos:7 '/sbin/init'
--network host 옵션을 주면 Docker를 실행하는 host의 network interface로 직접 매핑한다.
결론?
Docker를 쓰는 목적성(?)에 따라 host, bridge, none 모드 중 선택해서 사용하면 될것같다.