Issue
I want to compress (and later send with rsync to other server) my last backup Docker images for automated. I try this:
sudo docker save -o dockdebian.tar.gz | sudo docker images | awk 'NR==2{ print $3 }'
Select the the first ID of the image list. But gave me this error:
"docker save" requires at least 1 argument.
See 'docker save --help'.
Usage: docker save [OPTIONS] IMAGE [IMAGE...]
Save one or more images to a tar archive (streamed to STDOUT by default)
xxxxxxxxxxxx
Solution
You have to use command substitution in shell. More info here: https://www.gnu.org/software/bash/manual/html_node/Command-Substitution.html
docker save -o dockdebian.tar $(sudo docker images | awk 'NR==2{ print $3 }')
or
docker save -o dockdebian.tar `sudo docker images | awk 'NR==2{ print $3 }'`
Answered By - rafal1337 Answer Checked By - Mildred Charles (WPSolving Admin)