How to copy files from docker container to host using docker-compose in docker-machine How to copy files from docker container to host using docker-compose in docker-machine selenium selenium

How to copy files from docker container to host using docker-compose in docker-machine


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


  1. Power off the machine in Virtual box -> Change the Advanced settings in Virtual box

  2. Goto Shared Folders in Virtual box Give Path :: C:\DockerResults : Give a logical name for the Folder name

  3. Restart the machine in DockerTerminal with the below commanddocker-machine restart default

  4. After machine is started open the Virtual boxCreate a directory in the Virtual machine : sudo mkdir /Results

  5. Mount the directory to the local windows machine by executing the below command in virtual box: Sudo mount –t vboxsf DockerResults /Results
  6. Add volumes as below in docker-compose file

volumes:

    - /DockerResults:/home/Reports/