container image Application configuration files Application binaries / libraries Describe steps to build a container Container Image Containing minimum files Necessary to run the application ② Store and share container images ③ Deploy and execute images on host machines OS files Host Machine Image Registry
・・・ Physical / Virtual Machine Linux Kernel Traditional Linux environment Container environment Container Container ・・・ All applications see the same OS environment ▪ Linux container is a technology to "show" independent OS environments to different process groups. Linux Kernel Application Application Each container sees an independent environment • Local disk contents / Network (NIC, IP) / CPU , Memory resource / etc...
Linux kernel to split various resources. • • • Filesystem Hostname Inter process communication Users (UID/GID) Process table Network configuration CPU / Memory resources * Mount namespace (kernel 2.4.19) * UTS namespace (kernel 2.6.19) * IPC namespece (kernel 2.6.19) * User namespace (kernel 2.6.23 〜kernel 3.8) • • • • * PID namespace (kernel 2.6.24) * Network Namepsace (kernel 2.6.24) * Control groups ※ Reference " Namespaces in operation, part 1: namespaces overview " http:/ lwn.net/Articles/531114/ ▪ Linux container is realized by combining these mechanisms. Strictly speaking, there's no single technology you can call "container."
disk image (tar archive) associated with environment information like network configurations. ▪ The real uniqueness of Docker is its image management features. ▪ Dockerfile : Mechanism to automate image build process ▪ Image Registry : Mechanism to share and distribute container images Container Application Container Image Directory tree Attach as a root directory Mount locally on the host machine
commit Stopping container means stopping processes. Snapshot is kept remained. Snapshot is discarded when a container is removed You can clone the snapshot and store as a new image. Snapshot Processes Snapshot stop start rm Locally Stored Image run ✕ Locally Stored Image
eth0 External network 172.17.42.1 # docker run -d -p 8000:80 ・・・ Connect to IP of the host Linux TCP 8000 TCP 80 Port Forwarding ▪ External communication is proxied (nat-ed) on the host Linux. • • IP Masquarade is applied to packets from container to the external network. Port forwarding is configured with container options for packets from the external network.
on Application Management (OS layers should be invisible) ▪ Optimized Application Deployment with Resource Schedulers ▪ Abstraction and Autoscaling of Services ▪ Splitting Datastore and Application Runtime Built on Distributed Computing Technology Datacenter as a Computer Borg
Based on the Google's experience in container management. ▪ Useful features to manage microservices: ◦ Autoscale of pods ◦ Blue Green Deployment ◦ Rolling update ◦ etc.
scale multiple Pods from the same image. ▪ Service :Create a virtual IP address for Pods with the sama image. ReplicaSet - - replicas: 3 selector: - - app: MyApp version: v1 Deployment - name: MyApp Virtual IP Service - name: MyService
- app: MyApp version: v1 ReplicaSet - - replicas: 3 selector: - - app: MyApp version: v2 ▪ Launching groups of Pods with different versions. ▪ Change the default version by reconfiguring the Service. Virtual IP
GCP for Kubernetes clusters. ▪ Autobuild Kubernetes clusters through GUI/CUI/API. ▪ Easy integration with external datastore services such as Cloud SQL and Cloud Datastore. ▪ Easy integration with external networking services such as Cloud Load Balancing.