'SSLError unable to get local issuer certificate

I have a test script in Robot Framework which use Request library to send API request to external API services.

The test passed when run at local but failed when test run in docker.

I have set the verify=False when create session. The test is failed still.

Any idea, is that something wrong when I script API request atRequest Library or docker I need to add something else at docker-compose.yml?

 SSLError: HTTPSConnectionPool(host='speech.srs', port=7070): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))

script:

*** Settings ***
Library  Browser
Library  String
Library  RequestsLibrary
Library  Collections
Library  RPA.JSON
Resource            ../Resources/BrowserFunctions.robot
Suite Setup         Start New Browser
#Test Setup          Test Setup
#Test Teardown       Test Teardown
Suite Teardown      Close Browser

*** Test Cases ***
001-Models-Deploy
    Log To Console    SRS must up. Otherwise, the test is supposed to fail......
  #Verify SRS model-deployer is up
    Create Session   mysession   ${SRS-API-model-deployer}    verify=False
    ${resp}=    GET    ${SRS-API-model-deployer}
    Status Should Be    OK    ${resp}

docker-compose.yml:

version: '3'
services:
  robot-runner:
    build:
      context: .
      dockerfile: /Dockerfile
    container_name: robot-runner
#    image: ppodgorsek/robot-framework:latest
    image: robot-runner:latest
    user: root
    volumes:
      - ./BrowserTests:/opt/robotframework/tests
      - ./Resources:/opt/robotframework/Resources
      - ./test-audios:/opt/robotframework/test-audios
      - ./test-audios-additional-files:/opt/robotframework/test-audios-additional-files
      - ./test-audios-retrainAM:/opt/robotframework/test-audios-retrainAM
      - ./test-audios-retrainLM:/opt/robotframework/test-audios-retrainLM
      - ./test-audios-retrainLM:/opt/robotframework/test-audios-retrainLM-Auto-Text
      - ./test-Lexicon:/opt/robotframework/test-Lexicon
      - ./output-local:/opt/robotframework/reports
    environment:
      PYTHONWARNINGS: "ignore:Unverified HTTPS request"
    extra_hosts:
      - "speech.sts:172.17.0.1"
      - "speech.srs:172.17.0.1"
    networks:
      - sts_sts_network
networks:
  sts_sts_network:
    external: true


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source