3

I have the following docker-compose.yml file. When I run this I get the message "Please run 'docker pull elgalu/selenium', or use your own compatible image via --seleniumImageName". If I pull the image, my tests run fine. how can I pull the image automatically when I run the compose file, instead of manually pulling the image. thanks for your help

version: '3'

services:

  zalenium:
    image: repo.forge.lmig.com/docker/dosel/zalenium
    container_name: zalenium
    depends_on:
       - selenium
    ports:
      - "4444:4444"
    restart: unless-stopped
    tty: true
    command: ["start", "--desiredContainers", "5", "--maxDockerSeleniumContainers", "10","--sauceLabsEnabled","false","--screenWidth", "1920", "--screenHeight", "1080"]
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /Users/goutham/git/selenium-tests/test-output/videos:/home/seluser/videos
    privileged: true   
    networks:
      mynetwork:
        aliases:
          - chrome


 selenium-tests: 
    image: selenium-tests:latest
    container_name: selenium-tests-container      
    depends_on:
      - zalenium
    networks:
      mynetwork:  
    volumes:
     - /Users/goutham/git/selenium-tests/test-output:/test-output

networks:
  mynetwork:
    driver: bridge
Siyu
  • 11,187
  • 4
  • 43
  • 55

2 Answers2

3

Add a new service

  dep:
    image: elgalu/selenium
    command: echo 0
    restart: "no" # ensures it does not get recreated

Add this to Zalenium

  depends_on:
       - selenium
       - dep # ensures pull/launch order
Siyu
  • 11,187
  • 4
  • 43
  • 55
2

The image can be pulled automatically if you specify the environment variable

PULL_SELENIUM_IMAGE=true
diemol
  • 613
  • 3
  • 10