So raf we have only discussed a few basic Docker commands, which would allow us to run a single servic ein a singel container. however, you can probably appreciate that in the "real world" we usually need to have one or more applications running concurrently-for example, a website will have both a web application that fetches and processes data inresponse to activity from an end use and a database instance to log that information. In complex applications, the website might even be composed of multiple small web applications or microservices that are specialized to particular use case such as the fron end, user data, or an order management system. For these kinds of applications, we will need to have more than one container communicating with each other. The docker-compose tool(https://docs.docker.com/compose/)is written with such application in mind: it allows us to specify serverl Docker containers in an application file using the YAML format. For example, a configuration for a website with an instance of the Redis ddatabase might look like:
version: '3'
service:
web:
build:
port:
-"5000:5000"
volumes:
-.:/code
-logvolume01:/var/log
links:
-redis
redis:
image: redis
volumes:
logvolume01: {}
The tow application containers here are web and the redis database. The file also specified the volumes (disks) linked to these two applications. Using this configuration, we can run the command:
docker-compose up
This starts all the containers secified in the YAML file and allows them to communicate with each other. However, even though Docker containers and docker-compose allow us to construct complex applications using consistent execution environments, we may potentially run int issues with robustness when we deploy these services to the cloud. For example, in a web application, we connot be assured that the virtual machines that the application is running on will persist over long periods of time, so we need processes to manage self-healing and redundancy. This is also relevant to distributed machine learning pipeline, in which we do not want us to have backup logic to restart a sub-segment of work. Also, whuile Docker has the docker-compose functionallity to link together serveral containers in an application, it does not have robust rules for how communication should happen among those containers, or how to manage them as a unit. For these purposes, we turn to the Kubernetes library.
댓글 없음:
댓글 쓰기