Tuesday, December 3, 2019

Linux Container not allowing to install packages - Selenium network debugging

It started with someone who needed to containerize Selenium. There is standard help available on how to do this. But less when something goes wrong. One such scenario is the network connectivity. In our enterprise environment, connectivity is a mystery and it played a villain role here too.

Selenium providing the debug version of the container image. We tried that to include the ping utility as ping is not part of the standard Ubuntu package.

Below is the Dockerfile we tried to install network utilities into the Selenium image


FROM selenium/standalone-chrome-debug:3.141.59-xenon
RUN apt-get update && apt-get install -y iputils-ping
RUN apt-get install dnsutils
EXPOSE 4444
EXPOSE 5900

Didn't worked. It was complaining about the permission to install. We never used any user name and password while doing anything in this exercise. So confused on how to give permissions. Also, we are mainly a Windows shop. Fewer experts in Linux.

Finally, google helped as usual. We switched to root by using the USER keyword in Dockerfile and get the utilities installed.

FROM selenium/standalone-chrome-debug:3.141.59-xenon
USER root
RUN apt-get update && apt-get install -y iputils-ping
RUN apt-get install dnsutils
EXPOSE 4444
EXPOSE 5900

The beauty of containers is that only one person has to struggle. The Selenium image with network utilities can be obtained from the below location.

https://hub.docker.com/r/joymon/selenium-standalone-chrome-debug-network

For a person from the Linux world working with containers for long, this may not be big news:)

References

https://github.com/WASdev/ci.docker/issues/194
https://github.com/SeleniumHQ/docker-selenium/issues/725

No comments: