docker cp image code example
Example 1: copy files from a docker container to the host machine using cmd
docker cp <containerId>:/file/path/within/container /host/path/target
Example 2: docker extract file from image
docker cp $(docker create registry.example.com/ansible-base:latest):/home/ansible/.ssh/id_rsa ./hacked_ssh_key