How to do basic saving and loading of containers/images, steps taken from https://pspdfkit.com/blog/2019/docker-import-export-vs-load-save/

- start up docker daemon in separate terminal in project dir:

sudo dockerd

- assuming we already have a Dockerfile, build image using tag "calc" of current directory

sudo docker build --tag calc .

- check that docker actually built the image and stored it locally

sudo docker images OR sudo docker image ls

- run image tagged "calc" and see test output

sudo docker run calc

- save the image in question to a tar file in the current directory

sudo docker save calc > calc.tar

- check out the contents of the image after saving

mkdir calc && tar -xf calc.tar -C calc THEN tree calc

- delete the local image (if for some reason you want to rebuild/import it):

(get all containers)
sudo docker ps -a
(remove a specific container so we can delete the image later)
sudo docker rm <container_id>
(then delete the image via tag or id)
sudo docker image ls
sudo docker image rm <tag/id>

- also can delete all exited containers via this kickass command:

sudo docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs sudo docker rm

- load image from tar file

sudo docker load < calc.tar

- run it again to confirm it works (can also look and make sure image is there)

sudo docker run calc
