As you may know, selenium docker is the main stream way to do a real GUI End-2-End headless testing over Chrome / Firefox. While it really hassled me that the lack of docs to get it work behind corporate http proxy.
After days of trying, I finally featured out the way to get Selenium Chrome Docker (StandaloneChromeDebug) to adopt Oracle Proxy.
Here is the Dockerfile:
FROM selenium/standalone-chrome-debug MAINTAINER paul.lan@oracle.com ARG https_proxy ARG http_proxy ARG no_proxy ENV https_proxy {https_proxy} ENV HTTPS_PROXY{https_proxy} ENV http_proxy {http_proxy} ENV HTTP_PROXY{http_proxy} ENV no_proxy {no_proxy} ENV NO_PROXY{no_proxy} WORKDIR /tmp RUN echo "a2: Got Proxy setting as: {http_proxy}" RUN echo "http_proxy=\"{http_proxy}\"" >> /etc/environment && \ echo "HTTP_PROXY=\"{http_proxy}\"" >> /etc/environment && \ echo "https_proxy=\"{https_proxy}\"" >> /etc/environment && \ echo "HTTPS_PROXY=\"{https_proxy}\"" >> /etc/environment && \ echo "no_proxy=\"{no_proxy}\"" >> /etc/environment && \ echo "NO_PROXY=\"{no_proxy}\"" >> /etc/environment && \ echo "ftp_proxy=\"{http_proxy}\"" >> /etc/environment && \ echo "FTP_PROXY=\"${http_proxy}\"" >> /etc/environment
docker build script:
dockerBuildScript="docker build -t SeleniumStandaloneChromeDebug-Proxy-Image" assumedSeleniumDockerContainerName="mySeleniumChromeDebugContainer" if [[ ! -z {https_proxy} ]];then dockerBuildScript="{dockerBuildScript} --build-arg https_proxy='{https_proxy}'" fi if [[ ! -z{http_proxy} ]];then dockerBuildScript="{dockerBuildScript} --build-arg http_proxy='{http_proxy}'" fi if [[ ! -z {no_proxy} ]];then dockerBuildScript="{dockerBuildScript} --build-arg no_proxy='{no_proxy},{assumedSeleniumDockerContainerName}'" fi dockerBuildScript="{dockerBuildScript} -f Dockerfile ." eval "{dockerBuildScript}"
Here is the VNC screenshot:
Note that, to let docker pull
behind proxy over Oracle Linux 7, you have to set it to service first, just following:
https://docs.oracle.com/cd/E37670_01/E75728/html/section_kfy_f2z_fp2.html"