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
- See docker documentationhttps://docs.docker.com/compose/compose-file/#/volumes-volumedriver
- Similar question:How do I mount a host directory as a volume in docker compose
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 commanddocker-machine restart default
After machine is started open the Virtual boxCreate a directory in the Virtual machine : sudo mkdir /Results
- Mount the directory to the local windows machine by executing the below command in virtual box: Sudo mount –t vboxsf DockerResults /Results
- Add volumes as below in docker-compose file
volumes:
- /DockerResults:/home/Reports/