|
Introduction
Kitematic is a Docker GUI tool, it can be more quickly on Mac and Windows, simpler operation Docker. Docker official said, Kitematic its ecosystem to grow up a great project.
Kitematic simplify installation and provide local Docker a GUI environment to pull, build and run the container. If you have not tried it, you can download a trial under Kitematic.
The main objective is to Kitematic cooperate with each other and with DockerCLI provide seamless experience between them. For example, a user could run the following command to start a client in Docker container: docker run hello-world, and observe the results in Kitematic, and vice versa. Furthermore, our goal is together with other Docker tools out of the box, such as Docker Compose.
For example, if we remove a container from the command line, Kitematic will immediately reflect this change:
Application architecture: React and Flux
Kitematic entirely written in JavaScript. After considering the different architecture and framework, our ultimate architecture inspired from Facebook Flux. The overall architecture Kitematic
Stores: source of real data and logic needed to manage these data.
Components: In React to perform, it is responsible for rendering and capture data entered by the user stores the data.
Actions: Docker Remote API intermediate component or object interaction between the events generated by. Actions will be processed and stores the result in a change application data.
Utils: This is not a standard part of Flux achieved, but through actions to interact with external services. For example, Kitematic a DockerUtil object Docker Engine Remote API to interact.
When a container is removed through the client, the following occurs:
Docker Engine generates destroy event
This event, in turn, trigger a container destroyed action
Subscribing to container actions, ContainerStore, responsible for storing container data from its internal list of containers update data delete destroy the container.
UI components are responsible for the list container, ContainerList component corresponding re-rendered.
The Code: Propagating Docker Engine Events to Kitematic GUI
Let's dig into the different parts of the code base to look at is how to achieve, we do the following simplified.
1. Trigger action from Docker Remote API Events
Use dockerode library, listening Docker Remote API is very simple. In this case, if an event is received state is destroyed, it will create an action notify the relevant stores to update its internal data:
2. Update Container Store
ContainerStore object to execute a process to destroy any vessel operations, updating its internal data, to notify all listening components re-rendered.
3. In ContainerList React Component trigger update
Kitematic Advanced Containers React component listener update ContainerStore issued in this case, when ContainerList ContainerStore issued updated responsible for rendering the container along with a simple list of updated container data presentation.
ContainerList.react.js
to sum up
Recall This article explains how DockerCLI Kitematic or any integration Docker Engine. Tool use Docker Remote API, React and Flux to achieve real-time updates. I remember now download Kitematic try and give us feedback. |
|
|
|