📜 ⬆️ ⬇️

Docker 17.06 and Kubernetes 1.7: key innovations


Last week presented two “tasty” releases from the Open Source-world of containers: Docker (version 17.06) and Kubernetes (version 1.7) were updated almost simultaneously. What opportunities did they bring? The article provides information from the announcements and release notes of these releases with a few clarifications on some of the key changes.

Docker CE 17.06


June 28 was announced Docker CE (Community Edition) June 17 - the first release of the container system, assembled with the help of the project Moby , announced in April. More about Moby, we have already written .

Build in stages


The main feature of the release was the official stabilization of support for multi-stage builds (multi-stage builds), first introduced in Docker 17.05.0. Its essence lies in the ability to describe in one Dockerfile several stages of assembling an image so that intermediate data that are not required do not fall into the final image. The obvious example that Docker gives is that Java developers usually use Apache Maven to compile their applications, but Maven is not needed in the final container (image) to run these applications. Now you can arrange the Dockerfile in such a way that Maven itself will be used in the intermediate image (for assembly), but will not get into the final image (for launch).
')
Here is the Dockerfile option for a simple Java Spring Boot application :

FROM node:latest AS storefront
WORKDIR /usr/src/atsea/app/react-app
COPY react-app/package.json .
RUN npm install
COPY . /usr/src/atsea/app
RUN npm run build

FROM maven:latest AS appserver
WORKDIR /usr/src/atsea
COPY pom.xml .
RUN mvn -B -f pom.xml -s /usr/share/maven/ref/settings-docker.xml dependency:resolve
COPY . .
RUN mvn -B -s /usr/share/maven/ref/settings-docker.xml package -DskipTests

FROM java:8-jdk-alpine
WORKDIR /static
COPY --from=storefront /usr/src/atsea/app/react-app/build/ .
WORKDIR /app
COPY --from=appserver /usr/src/atsea/target/AtSea-0.0.1-SNAPSHOT.jar .
ENTRYPOINT ["java", "-jar", "/app/AtSea-0.0.1-SNAPSHOT.jar"]
CMD ["--spring.profiles.active=postgres"]


As you can see, the two preparatory stages here use Node.js and Apache Maven to build the application, but the resulting image will be compact, not having Node.js or Maven in its composition.

Note : So far in our company we have used a feature called artifacts in our own Open Source utility dapp for this purpose ( see its overview here ).

Logs and metrics


Docker metrics can now be used in plugins. For the demonstration, an example of a plugin is shown that proxies requests for a metric that is available in it:

 $ docker plugin install --grant-all-permissions cpuguy83/docker-metrics-plugin-test:latest $ curl http://127.0.0.1:19393/metrics 

But this is only a demonstration, and the real purpose of this innovation is to send the collected metrics to an external service with the help of plug-ins or make them available for assembly by another service (for example, Prometheus).

Plug-ins can now also be used for logs (that is, to implement logging drivers), and a list of all logging drivers has been added to docker info . In addition, the implementation of docker service logs , which (also from the last release on May 17, 2005) can show individual task logs ( /task/{id}/logs in REST), was transferred from the Edge branch to Stable, so it is now easy to get generalized logs for the entire service running in swarm.

Network


It became possible to link services to networks within a node (node-local): Host, Macvlan, IPVlan, Bridge, local-scope. An example for Macvlan is the creation of site-specific network configurations on the work nodes and the network on the management node, which will apply them:

 [Wrk-node1]$ docker network create --config-only --subnet=10.1.0.0/16 local-config [Wrk-node2]$ docker network create --config-only --subnet=10.2.0.0/16 local-config [Mgr-node2]$ docker network create --scope=swarm --config-from=local-config -d macvlan mynet [Mgr-node2]$ docker service create --network=mynet my_new_service 

As part of the same change, the DOCKER-USER chain was added to iptables, which is inserted first into FORWARD and is not reset (for this addition, thanks to ertaquo !) .

In addition, changes have been made to the internal algorithms of Service Discovery, which are designed to improve the logic of its work.

Swarm


A number of innovations received the Swarm mode, and in particular:


A more detailed changelog in Docker 17.06 along with links to commits can be found in Docker CE release notes . And for those who like to watch and listen, there is an 8-minute video with a story and a demonstration of the main innovations.

Kubernetes 1.7


June 29 was announced by Kubernetes 1.7 , the main innovations of which are called improvements in security, support for stateful applications, extensibility of the platform. What is behind this?

Security



Support for stateful applications



Extensibility



Other


Source: https://habr.com/ru/post/332160/


All Articles