Actions

Docker

From /oooooooooo.io/

build

sudo docker build -t calculator_api:latest .

Load image file into local docker images repository

sudo docker load -i calculator_api.tar

Run container

sudo docker run --rm -p 6543:6543 --name calculator_api calculator_api:latest

Enter running container

sudo docker run --rm -it --entrypoint=/bin/sh calculator_api:latest

save to image

sudo docker save calculator_api:latest | gzip > calculator_api.tar.gz

Shutdown the docker container gracefully:

sudo docker stop calculator_api

Persistent Storage with host Volumes

with local dir

sudo docker run --rm --name calculator_api -v /local/dir/:/persistent/dir/in/container  calculator_api:latest


with docker volume

sudo docker volume create volume_name
sudo docker volume ls 
sudo docker volume inspect volume_name
sudo ls /var/lib/docker/volumes/wiki_imgs/_data
build image
sudo docker run --rm --name calculator_api -v volume_name:/persistent/dir/in/container  calculator_api:latest</code>

The persistent dir in the container will be mounted to a volume inside /var/lib/docker/volumes/

Other operations

Copy file from local system to docker container

sudo docker cp localfile continerid:/destination/of/file

Code Notes 2020

Facts about "Docker"
SectionCode Notes +
Date
"Date" is a type and predefined property provided by Semantic MediaWiki to represent date values.
2020 +