Docker Volumes - Persisting Data

In my case I had a large amount of files to be used in a 'downloads' directory for Nginx. Ieally I wanted these files to be in a container. This is where Docker Volumes comes in.

# create an empty volume
docker volume create myvolume
# create a temporary container and mount the volume
docker container create --name temp -v myvolume:/root hello-world
# using the temporary container, copy from local file system to volume
docker cp targetfolder temp:/root
# remove the temporary container
docker rm temp

There are lots of variations of the above; one liners etc.

Saving to Docker Hub

I haven't tried it, but there's a description on dzone.com