Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building your own docker images of SeleniumHQ/docker-selenium

I'm not sure if it is a bug or just me being stupid but here is the case.

I want to build my image based on StandaloneChromeDebug. Following the Wiki:

  1. Pull the repo.

  2. Generate image:

$ make standalone_chrome_debug
  1. Build the Dockerfile to insure that no errors arise:
$ docker build --no-cache etc/docker-selenium/StandaloneChromeDebug/
  1. Set up my image to the docker-compose.yml like:
selenium-hub:
        container_name: selenium-hub
        build: ./etc/docker-selenium/StandaloneChromeDebug/
        volumes:
            - /dev/shm:/dev/shm
        ports:
            - "4444:4444"
            - "5900:5900"
        environment:
           - HUB_HOST=selenium-hub
           - HUB_PORT=4444

And... nothing. The container is running (no errros) but Selenium doesn't work, container log is empty, /opt/ folder is empty. What am i doing wrong? How to debug the thing?

like image 209
Yevgen Avatar asked Aug 22 '19 09:08

Yevgen


People also ask

How do I create a docker file in selenium?

Deploy Selenium Grid by running Selenium Hub and then separate nodes for Chrome/Firefox combinations. These nodes would be connected to Selenium Grid. Create Docker image which would contain everything necessary for running tests (rvm, ruby) Run that image as a docker container and copy over content of our tests.

Does selenium work in docker?

Running Selenium Tests in Docker. Once the Docker Desktop is installed, it can run a few docker images. You can either create a Docker image from scratch or pull an already configured base image from the Docker hub and then add on to it.

What is docker and difference between docker and selenium grid?

Docker compose is the tool using which you can Selenium Grid on multiple containers. You can deploy Selenium Grid with hub and nodes for parallel execution. Docker-compose uses YAML file to configure the application services like a hub, chrome and Firefox will be the services in this case.

What is selenium Docker?

Selenium Docker. The project is made possible by volunteer contributors who have put in thousands of hours of their own time, and made the source code freely available under the Apache License 2.0.

What is a dockerfile and how to create one?

A Dockerfile is a text document that contains the instructions to assemble a Docker image. When we tell Docker to build our image by executing the docker build command, Docker reads these instructions, executes them, and creates a Docker image as a result. Let’s walk through the process of creating a Dockerfile for our application.

How do I build a docker image?

The docker build command builds Docker images from a Dockerfile and a “context”. A build’s context is the set of files located in the specified PATH or URL. The Docker build process can access any of the files located in this context. The build command optionally takes a --tag flag.

What is the Docker tag command?

The docker tag command creates a new tag for an image. It does not create a new image. The tag points to the same image and is just another way to reference the image. Now, run the docker images command to see a list of our local images.


1 Answers

Path is wrong, use build: /etc/docker-selenium/StandaloneChromeDebug/ without .
If you try to cd to ./etc/docker-selenium/StandaloneChromeDebug/, you will get an error.

version: "3.5"
services:
   selenium-hub:
        container_name: selenium-hub
        build: /etc/docker-selenium/StandaloneChromeDebug/
        volumes:
            - /dev/shm:/dev/shm
        ports:
            - "4444:4444"
            - "5900:5900"
        environment:
           - HUB_HOST=selenium-hub
           - HUB_PORT=4444

Exapmle: enter image description here

like image 101
Sers Avatar answered Sep 21 '22 08:09

Sers