Getting an error with Chromedriver using docker - docker

Below are details of the Docker file:
FROM python:3
RUN python3 -m pip install robotframework==3.0.4
RUN python3 -m pip install robotframework-seleniumlibrary==3.2.0
RUN python3 -m pip install selenium==3.14.0
# Install Chrome for Selenium
RUN curl https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /chrome.deb
RUN dpkg -i /chrome.deb || apt-get install -yf
RUN rm /chrome.deb
# Install chromedriver for Selenium
RUN curl https://chromedriver.storage.googleapis.com/2.42/chromedriver_linux64.zip -o /usr/local/bin/chromedriver
RUN unzip -o /usr/local/bin/chromedriver -d /usr/local/bin
RUN chmod 777 /usr/local/bin/chromedriver
After that, executed below commands:
sudo docker build -t rb/robot-docker
sudo docker run -ti -v /home/Automation:/usr/src/project rb/robot-docker bash
root> cd /usr/src/project
root> robot sample-0-trivial/sample-0-trivial.txt
It gives the error message as:
"WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 127"

Related

conda: not found - Docker container do not run export PATH=~/miniconda3/bin:$PATH

I have the following Dockerfile:
FROM --platform=linux/x86_64 nvidia/cuda:11.7.0-devel-ubuntu20.04
COPY app ./app
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y upgrade && apt-get install -y apt-utils
RUN apt-get install -y \
net-tools iputils-ping \
build-essential cmake git \
curl wget vim \
zip p7zip-full p7zip-rar \
imagemagick ffmpeg \
libomp5
# RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
COPY Miniconda3-latest-Linux-x86_64.sh .
RUN chmod guo+x Miniconda3-latest-Linux-x86_64.sh
RUN bash Miniconda3-latest-Linux-x86_64.sh -b -p ~/miniconda3
RUN export PATH=~/miniconda3/bin:$PATH
RUN conda --version
RUN conda update -n base conda
RUN conda create -y --name servier python=3.6
RUN conda activate servier
RUN conda install -c conda-forge rdkit
CMD ["bash"]
When I run: docker image build -t image_test_cuda2 . it breaks in the RUN conda --version.
The error is RUN conda --version: ... /bin/sh: 1: conda: not found. The problem is that RUN export PATH=~/miniconda3/bin:$PATH is not working. It is not creating conda link in the PATH.
If I build the image until RUN bash Miniconda3-latest-Linux-x86_64.sh -b -p ~/miniconda3 and manually I get access to the container using docker exec -it <id> /bin/bash and then from the #/ manually I run the same command #/export PATH=~/miniconda3/bin:$PATH it works good. If I manually run the next command inside the container RUN conda update -n base conda it works good.
The conclusion is that it seems that the command RUN export PATH=~/miniconda3/bin:$PATH is not working in Dockerfile - docker image build. How to solve this issue?

How do I install gecko driver and firefox on my docker image apache/airflow:2.1.4

I am trying to use Selenium on one of my airflow tasks. I have airflow running on apache/airflow:2.1.4 docker image.
I get the following error when I use selenium in my airflow task (since I'm missing firefox)
FileNotFoundError: [Errno 2] No such file or directory: 'firefox': 'firefox'
How would I go about adding geckodriver and firefox to the airflow image?
I have my docker-compose build the following Dockerfile for airflow,
FROM apache/airflow:2.1.4
WORKDIR /python_dependencies
COPY ./requirements.txt .
RUN pip3 install -r requirements.txt
apache/airflow:2.1.4 is based on debian, so you just need to use apt-get install firefox-esr to get firefox command, while download pre-built binary from geckodriver github to install geckodriver.
Dockerfile:
FROM apache/airflow:2.1.4
USER root
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates curl firefox-esr \
&& rm -fr /var/lib/apt/lists/* \
&& curl -L https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz | tar xz -C /usr/local/bin \
&& apt-get purge -y ca-certificates curl
USER airflow
Verify:
$ docker build -t abc:1 .
$ docker run --rm -it --entrypoint=which abc:1 firefox
/usr/bin/firefox
$ docker run --rm -it --entrypoint=which abc:1 geckodriver
/usr/local/bin/geckodriver

GUI menu in docker container freezes (ubuntu parent image)

I've been trying to run a docker container including the esp8266 toolchain and ESP8266_RTOS_SDK.
After the Dockerfile is done the 'Espressif IoT Menu' pops up but freezes instantly and I cant control anything. Screenshot of the menu. I thought maybe I had to run the container endlessly, but it didn't help either. I tried this command: RUN tail -f /dev/null.
What else I thought is that the container might be missing some programs for a terminal?
Here is my Dockerfile (first time working with docker):
FROM ubuntu:latest
# -------------------------- TOOLCHAIN --------------------------------------
WORKDIR /
RUN apt-get update && apt-get install -y software-properties-common
RUN apt update && add-apt-repository universe
RUN apt-get -y install gcc wget git make libncurses-dev flex bison gperf python3 python3-serial python3-pip
RUN mkdir -p downloads esp8266
ADD https://dl.espressif.com/dl/xtensa-lx106-elf-linux64-1.22.0-100-ge567ec7-5.2.0.tar.gz downloads
RUN cd esp8266;tar -xzf /downloads/xtensa-lx106-elf-linux64-1.22.0-100-ge567ec7-5.2.0.tar.gz
ENV PATH=/esp8266/xtensa-lx106-elf/bin:$PATH
# -------------------------- ESP8266_RTOS_SDK ---------------------------------
RUN cd esp8266;git clone https://github.com/espressif/ESP8266_RTOS_SDK.git
ENV IDF_PATH="/esp8266/ESP8266_RTOS_SDK"
RUN ln -s /usr/bin/python3 /usr/bin/python #otherwise python wont be found
ENV TERM xterm #otherwise "terminal unknown"
RUN python3 -m pip install --user -r $IDF_PATH/requirements.txt
RUN cd esp8266;cp -r $IDF_PATH/examples/get-started/hello_world .
RUN cd /esp8266/hello_world;make menuconfig
I run the container with:
sudo docker build -f $(pwd)/dEsp8266 -t espenv .
The guide's I used:
For the toolchain: https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/linux-setup.html
For the RTOS_SDK: https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/index.html#get-started-get-esp-idf

how to pass url link in dockerfile to create different containers based on url argument

i have dockerfile which is;
FROM centos/systemd
CMD ["/usr/sbin/init"]
RUN yum install xorg-x11-server-Xorg xorg-x11-xauth xorg-x11-apps bzip2 wget gtk3 initscripts sudo -y
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y install xrdp tigervnc-server
RUN cd /usr/local
RUN wget http://ftp.mozilla.org/pub/firefox/releases/76.0/linux-x86_64/en-US/firefox-76.0.tar.bz2
RUN tar xvjf firefox-76.0.tar.bz2
RUN ln -s /firefox/firefox /usr/bin/firefox
RUN systemctl enable xrdp
RUN echo "/usr/bin/firefox --private-window --kiosk https://facebook.com" >~/.xsession
RUN chmod +x ~/.xsession
it creates image and then, containers generated from this image. but i want some containers open different url than
kiosk https://facebook.com
ie: twitter.com, instagram.com etc.
by using same image.
how can i pass this url argument?
is there a way that i can run it with my docker run command?
edit
my file.sh:
#!/bin/bash
url=$1
echo "/usr/bin/firefox --private-window --kiosk $url " >/root/.xsession
chmod +x /root/.xsession
tail -f /dev/null
dockerfile:
FROM centos/systemd
CMD ["/usr/sbin/init"]
RUN yum install xorg-x11-server-Xorg xorg-x11-xauth xorg-x11-apps bzip2 wget gtk3 initscripts sudo -y
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y install xrdp tigervnc-server
RUN cd /usr/local
RUN wget http://ftp.mozilla.org/pub/firefox/releases/76.0/linux-x86_64/en-US/firefox-76.0.tar.bz2
RUN tar xvjf firefox-76.0.tar.bz2
RUN ln -s /firefox/firefox /usr/bin/firefox
RUN systemctl enable xrdp
RUN touch ~/.xsession
COPY ./file.sh /
ENTRYPOINT ["/usr/sbin/init","-D","FOREGROUND","./file.sh"]
RUN echo 'root:basak' | chpasswd
but it still does not write url. where is the problem?

not able to start uwsgi as a service in docker

1)I have copied my demo.ini file inside /etc/uwsgi/app-enabled/demo.ini
2)I have installed the package apt-get install uwsgi-plugin-python
3)Added the plugins= python in demi.ini file
now when i hit the command sudo service uwsgi status it shows output which?
FROM base_image
RUN apt-get -y install uwsgi
COPY workspace /home/nt/workspace
RUN ln -s /home/nt/workspace/backend.conf /etc/nginx/sites-enabled/backend.conf
RUN ln -s /home/nt/workspace/nti-backend/environment/development.ini /etc/uwsgi/apps-enabled/
RUN pip install -r /home/nt/workspace/nti-backend/requirements.txt
ENTRYPOINT sh /home/nt/workspace/startup.sh && /bin/bash

Resources