0

I want build a docker image for java and chromedriver.This is my dockerfile.


FROM java:8
MAINTAINER LIU JICHUN jliu666@hotmail.com
ENV TZ Asia/Shanghai

RUN echo "deb http://mirrors.ustc.edu.cn/debian/ jessie main contrib non-free" > /etc/apt/sources.list \
    && echo "deb-src http://mirrors.ustc.edu.cn/debian/ jessie main contrib non-free" >> /etc/apt/sources.list \

    && echo "deb http://mirrors.ustc.edu.cn/debian/ jessie-updates main contrib non-free" >> /etc/apt/sources.list \
    && echo "deb-src http://mirrors.ustc.edu.cn/debian/ jessie-updates main contrib non-free" >> /etc/apt/sources.list \

    && echo "deb http://mirrors.ustc.edu.cn/debian/ jessie-backports main contrib non-free" >> /etc/apt/sources.list \
    && echo "deb-src http://mirrors.ustc.edu.cn/debian/ jessie-backports main contrib non-free" >> /etc/apt/sources.list \

    && echo "deb http://mirrors.ustc.edu.cn/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list \
    && echo "deb-src http://mirrors.ustc.edu.cn/debian-security/ jessie/updates main contrib non-free" >> /etc/apt/sources.list \
    && apt-get update \
    && apt-get install -y libxss1 libappindicator1 libindicator7 xvfb unzip fonts-liberation libappindicator3-1 libatk-bridge2.0-0 libgtk-3-0 lsb-release xdg-utils\
    && wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
    && dpkg -i google-chrome*.deb \
    && apt-get install -f \
    && wget -N https://chromedriver.storage.googleapis.com/2.42/chromedriver_linux64.zip \
    && unzip chromedriver_linux64.zip \
    && chmod +x chromedriver \
    && mv -f chromedriver /usr/local/share/chromedriver \
    && ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver \
    && ln -s /usr/local/share/chromedriver /usr/bin/chromedriver \

But when I run the chromedriver, an error like this:


Starting ChromeDriver 2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac) on port 24557
Only local connections are allowed.
[1538823654.540][SEVERE]: bind() returned an error, errno=99: Cannot assign requested address (99)
2018-10-06 19:00:54.747  INFO 1 --- [ null to remote] o.o.selenium.remote.ProtocolHandshake    : Detected dialect: OSS
JICHUN
  • 103
  • 3
  • 9

1 Answers1

0

Searching on google, it seems like there is an open issue in the docker-chromedriver repository that suggests to:

  • install chrome-headless
  • expose port 9515 on the Dockerfile

Although it could be a problem with ports already opened (see here), so be sure the port is not being already used by other processes.

Polpetta
  • 495
  • 1
  • 3
  • 13