Get the App
SLTechnology News&Howtos  ›  Servers  › 

Introduction of development kit tools based on Docker encapsulation

Shulou Source: shulou.com Published: 2022-06-01 12:51:05 10月02日 Update

This article introduces the knowledge of "introduction of development kit tools based on Docker package". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Based on the development package developed by Docker1.12+ (Docker API 1.24 +), by encapsulating Docker API, developers can quickly use Java to develop applications to control and operate Docker, using streaming operation, simple and clear.

To provide Javaer friends with a convenient and direct way to operate Docker.

The coverage rate of perfect test cases is 87%.

JDocker is a subproject of the Voovan open source project, which naturally depends on the voovan open source project.

Maven dependency on Voovan projects: org.voovanvoovan-framework1.0-beta-*, connects to Docker by setting environment variables in org.voovan.docker.DockerGlobal.

Public static String DOCKER_REST_HOST = "127.0.0.1"; public static int DOCKER_REST_PORT = 2735; public static String DOCKER_REST_CHARSET = "UTF-8"; public static int DOCKER_REST_TIMEOUT = 5; public static boolean DEBUG = false

Create a container using JDocker:

/ / construct a creation command CmdContainerCreate createCmd = CmdContainerCreate.newInstance ("d_test") / use streaming operation to create container Object data = createCmd.image ("alpine"). Network ("bridge") .volume ("v_tx:/v_tx"). Link ("dockerfly:dockerfly") .cmd ("ping", "127.0.0.1"). Env ("author=helyho") .exposePort (22, "tcp", "2222"). Send () CreateCmd.close (); Logger.info (formatJSON (data)); "introduction to development kit tools based on Docker encapsulation" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Development package project tool content container more knowledge utility learning next variables commands dilemmas subitems subprojects actual guys buddies Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information OPPO Reno Shulou Technology NVidia Docker