- docker
Debian & Debian-based Linux distributions:
1) Apt Install
apt update
apt -y install docker-ce docker-ce-cli containerd.io
2) Install manually
apt -y install apt-transport-https ca-certificates curl
curl -fsSL https://get.docker.com/ | sh
Test the docker installation
docker run hello-world
The the following script
docker run -v {image directory}:/workdir {docker image} {script argument}
Example:
docker run \
-v $(pwd)/images:/workdir \
rashkopetrovdev/img-optimize:latest \
--help
You can build your own docker image:
docker build \
--squash \
-f ./docker/Dockerfile \
-t {docker hub account}/{image name}:{image tag} \
-t {docker hub account}/{image name}:latest \
.
Example:
docker build \
--squash \
-f ./docker/Dockerfile \
-t rashkopetrovdev/img-optimize:stretch-slim-0.21.06.24 \
-t rashkopetrovdev/img-optimize:latest \
.
Push your image to the docker hub repository
git push {docker hub account}/{image name}:{image tag}
git push {docker hub account}/{image name}:latest
Example:
git push rashkopetrovdev/img-optimize:stretch-slim-0.21.06.24
git push rashkopetrovdev/img-optimize:latest
echo "alias optimize='docker run -v \$(pwd):/workdir {docker image} {script argument}'" >> $HOME/.bashrc
source $HOME/.bashrc
Example:
echo "alias optimize='docker run -v \$(pwd):/workdir rashkopetrovdev/img-optimize:latest'" >> $HOME/.bashrc
source $HOME/.bashrc
optimize --help