Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 1.55 KB

Docker.md

File metadata and controls

43 lines (30 loc) · 1.55 KB

Docker

Docker is a containerization tool for unix OSes. It implements many ideas of the Open Container Initiative (OCI) but does that in a rootful manner. For the rootless containerization one can use the /Podman.

Resources

hadolint

hadolint is a linter for Dockerfiles. Uses /Haskell powered shellcheck under the hood.

Usually, I run hadolint using such script:

#!/bin/sh

FILE="$(pwd)/Dockerfile"
if [ ! -f "$FILE" ]; then
    echo "Dockerfile not found!"
else
    docker run --rm -i hadolint/hadolint < "$FILE"
fi

Recipies

Run as a script

Sometimes I need to run some dockerized app from shell having a couple of volumes mounted in "rw" mode. That's how I wrap such calls into shell scripts:

docker run --rm \
       -u $(id -u):$(id -g) \
       -v "$PWD":/data:rw \
       -e VAR="value" \
       image:latest \
       $*

The "-u $(id -u):$(id -g)" part keeps you away from problems with permissions.