To extract a single file or folder from a docker image, simply use the docker create command which creates a container from an image without actually starting it.
By assigning a name to that container it gets accessible easily:

$ docker create --name my-cont alpine:latest
6a6d8f6d176b533a33d684fe0268d31c8db755ad087433a74f144ffe7664cf71
$ docker cp my-cont:/etc/alpine-release release.txt
Successfully copied 2.05kB to ~/release.txt
$ cat release.txt
3.19.1
$ docker rm my-cont

The upper snippet creates a container named my-cont from the latest Alpine linux image:
$ docker create --name my-cont alpine:latest
This command prints the container id to stdout, but since we gave it name we don’t care about.

Next line copies the file /etc/alpine-release from the container to the local file release.txt:
$ docker cp my-cont:/etc/alpine-release release.txt

At least remove the container:
$ docker rm my-cont

Of course this works with folders, too.