Access is denied while docker save

I workaround the problem on linux by changing the current forlder permission to 777. Make sure your current direct :

mkdir ~/docker-images
cd ~/docker-images
chmod 777 ./
sudo docker save <img_id> -o ./<filename>

Never mind, along with path I need to give my new file name that docker wanted to create and it don't happen implicitly, in my cases I gave

docker save -o ./<tar name that you wanted docker to create> <imgID>

For the similar issue but on unix:

root@linux:/opt/docker# docker save -o ./presto.tar starburstdata/presto
open .docker_temp_359214587: permission denied

You can use different syntax to save the image as a workaround:

root@linux:/opt/docker# docker save starburstdata/presto > presto.tar
root@linux:/opt/docker# ls -l
razem 1356196
-rw-r--r-- 1 root root 1388737024 maj 23 11:16 presto.tar