Docker Flashcards
4, 7
Docker containerisation process
code
Docker file
$docker build
Docker image
$docker run
Docker container
docker architecture
( docker client + docker host + registry ) on network protocol stack
downsides of containerisation (4)
- performance overhead: every machine that needs to run the microservice needs to have Docker installed
- upfront investment is higher: images/containers take space
- images/containers can get damaged/lost
- easier to package inappropriate/illegal/malicious content into images/containers without being detected
Docker Compose
Docker Management tool
- defines and runs multi-containers
- use YAML files to define the configurations of containers
use “docker-compose” to run containers and related operations according to the configurations in the YAML file
YAML
- describe software configurations in a human-readable way
container networking
each container running on a docker host is in an internal subnetwork set up by the docker engine (acts as a gateway for the containers, providing networking capabilities)
- docker engine sets up an internal network on the docker host, assigns dynamic IP addresses to each container in the internal network (only available in internal network)
communication among networking
- container and the host in the same internal network use IP addresses
- container can be assigned a name => communicate in same subnetwork ( act like host names )
- containers in external networks need NAT through the docker engine and docker host
accessing a microservice inside a container
- internal IPs are invalid externally => intermediary to translate between external and internal IPs (eg. docker engine)
- port mapping
*external client may access host IPs (docker host) in external network
Network Address Translation
- map one network address to another by modifying the address information in network communication data
- allow data to be rerouted by the network to a different receiver or can appear to come from a different sender
port mapping
- redirecting communication data from IP:port number to another IP:port number
- docker engine maps an (external) port of the docker host (a.k.a. host port) to an (internal) port of the container (a.k.a. container port); after that, all incoming request data going to the host port is forwarded to the container port of a particular container; the data replied from the container is forwarded by the docker engine and host back to the original client.
- different container different port number