on linux containers • Docker is a container engine that uses Linux Kernel features to • Create containers on top of operating system • Automate application deployment to container • Provide lightweight environment to run your application code.
or memory of the host machine. • For example : When no available memory , linux kernel will throw out of memory exception and kill other processes • Whole system can crash • Attackers will use this knowledge to bring down your apps down • All the containers can crash
and Memory on all of your containers • A container that runs out of resources will shut down. • Isolation protects all of your other containers to shut down
CPU And Memory • From the command line use the following flags : • -m to restrict memory • -cpu to determine how much cpu your container will use docker run -p 49160:8080 -d tamatwe/unlimited_server_cpu -m 0.5 -cpu 0.5
time we are using secrets inside our applications • We usually store the secrets in files • Password • SSL certificate • SSH private key • TLS certificates and keys • When we build a Dockerfile , in that case , by using COPY or ADD we copy the requested secrets into our docker image.
statements in your Dockerfile • Each can use a different base • Each begins new stage of the build • Fetch and manage secrets in an intermediate image layer that is later disposed of so that no sensitive data • reaches the image build • Held in cache
available only when using Docker Swarm, or when using docker compose. • Docker secret is stored as a blob of data • Use Docker secrets to centrally manage this data and securely • A secret is only accessible to those services which have been granted explicit access to it, and only while those service tasks are running
data between containers and the host machine • Can be defined by : • -v flag on run command • docker-compose • Volumes are directories that are • Outside the default union files • Exist as normal directories and files in the host file system
data • Pro - • This is helping by making them not visible in docker inspect command • Cons - • If they are stored in Volumes - by default , when Docker container runs as root, those secrets can be accessed • By accessing the volumes, files from the host machine can be reachable too Docker Volumes For Storing Sensitive Data
Use -u flag to specify user : • docker run -u 1000 <IMAGE_PARAMS> • in linux 0-499 are reserved users. Use a user above 500 to avoid running as system user.
Docker container capabilities • —cap-add - Add Docker container capabilities • Don’t use —privileged - • Give all linux kernel capabilities to the container
such that images are built in layers • Each image has several parents that it takes its functionality from them • You always base your image on other image that you pulled from Docker hub • You can pull an image that has vulnerabilities, exploits and other malicious components.