Docker is a platform popularly used for containerization, offering a standardized way to develop, ship, and run applications across different environments. It simplifies the process of creating and distributing applications, from traditional to modern, and ensures secure deployment across various setups.
Containerd
It is a standalone container runtime designed to work alongside container engines and infrastructure-as-code tools. It focuses on simplicity, having only essential features required by its users. It is used by Docker to run containers but supports only a subset of Docker’s functionalities.
Docker’s architecture consists of several key components:
Docker Engine- the main component responsible for building, running, and administering containers.
Containerd- a low-level container runtime that handles container lifecycle management, including image transfer, storage, execution, monitoring, and networking.
Container Shim- an intermediary that manages headless containers, taking over from runc after initialization.
runc- a lightweight container runtime that aligns with the OCI standard, used by containerd to start and manage containers.
gRPC- facilitates communication between containerd and the docker-engine, ensuring efficient interaction.
Open Container Initiative(OCI)- maintains specifications for runtime and images, with the latest docker versions complying with both OCI image and runtime standards.
Basic Commands
To get Docker version:
`docker version`
To get more information about Dockr settings:
`docker info`
To pull an image from a registry
`docker pull registry:5000/alpine`
To inspect a container
`docker inspect <containerid>`
To list networks
`docker network ls`
To execute a command in a running container
`docker exec-it <containerid> /bin/sh`
To commit changes to a container image
`docker commint <containerid> registry:5000/name-container`
To stop running a container
`docker stop <containerid>`
To remove a container
`docker rm <containerid>`
To list images
`docker image ls`
To remove an image
`docker rmi <imagename>`
Podman
It is a an open-source container engine that adheres to the OCI standards. It stands out from Docker with several distinct features:
Daemonless architecture- unlike Docker’s client- server model with a background daemon, Podman operates without a daemon.
Rootless containers- allows running containers the initiating user’s privileges, enhancing security.
Compatibility with Docker API- uses the same CLI commands as Docker, allowing seamless integration.
Default Port and Authentication
The default port for Docker’s remote API is 2375 when enabled. However, by default, the service does not require authentication, which can be exploited by attackers to start privileged containers or access sensitive data.
Enumeration: to enumerate Docker information. You can use various methods
Using curl:
Using docker command:
Exploiting Docker: several vulnerabilities can be exploited in Docker
Privilege Escalation:
Accessing Host Files:
Discovering Secrets:
Comments