I have reports generated in gradle container for my selenium tests, I am trying to copy the files from docker container to local host. As a work around, I have used docker cp to copy files from container to my local and it works. How to achieve it with docker-compose volumes.
Below is my docker-compose.yml
version: "3 "
services:
selenium-hub:
image: selenium/hub
container_name: selenium-hub_compose
ports:
- "4444:4444"
chrome:
image: selenium/node-chrome-debug
container_name: selenium-chrome
depends_on:
- selenium-hub
ports:
- "5900"
environment:
- http_proxy=http://x.x.x.x:83
- https_proxy=http://x.x.x.x:83
- HUB_HOST=selenium-hub
- HUB_PORT=4444
gradle:
image: gradle:jdk8
container_name: selenium-gradle
build:
context: .
dockerfile: dockerfile
I run the command docker-compose up
-> it runs the selenium tests and generates the report in the container.
Can anyone help on this?
The normal way to pass data from container to host is using docker volumes. In short you specify a host directory and map it to the directory inside container. And that directory should be used to save your test reports
services:
selenium-hub:
image: selenium/hub
container_name: selenium-hub_compose
ports:
- "4444:4444"
volumes:
- ./path/to/report/folder:/host/reports
Power off the machine in Virtual box -> Change the Advanced settings in Virtual box
Goto Shared Folders in Virtual box Give Path :: C:\DockerResults : Give a logical name for the Folder name
Restart the machine in DockerTerminal with the below command docker-machine restart default
After machine is started open the Virtual box Create a directory in the Virtual machine : sudo mkdir /Results
volumes:
- /DockerResults:/home/Reports/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With