Automatically build Sdkman mirrors with Docker __docker

Source: Internet
Author: User
Tags curl docker run
Open the package is used, do not look at the code.

If you are in a hurry to use a mirror that I built directly, start by Configuring the mirror source to see about Sdkman

sdkman! is the tool for managing parallel versions of multiple software development kits on most UNIX based systems,
The official website is

http://sdkman.io/

Sdkman installation is simple.

$ curl-s "Https://get.sdkman.io" | Bash

However, when the network is limited, it is not suitable for automatic installation, at this time can build the mirror with Docker, then distribute to target device.

Because the Sdkman is open source software, the mirrors built do not need to be kept secret, so it can be built as a public mirror with the help of the Docker mirror build service. Building a mirrored script

Register your account on https://github.com/, my account is

Https://github.com/huzhenghui

Create a project for building a mirror, in this case

Https://github.com/huzhenghui/SDKMAN-Docker-Autobuild

which contains a file for building mirrors

Https://github.com/huzhenghui/SDKMAN-Docker-Autobuild/blob/master/Dockerfile

Content is

From Debian:stretch

LABEL maintainer= "hu@daonao.com"

RUN apt-get update && \
    apt-get install-y Curl Unzip zip && \
    curl-s "Https://get.sdkman.io" | bash
Create a mirrored warehouse

Register your account on https://hub.docker.com, my account is

https://hub.docker.com/r/huzhenghui/

Create a warehouse for saving mirrors, in this case

Https://hub.docker.com/r/huzhenghui/sdkman

Follow the instructions for creating a warehouse on the Docker web site to set up the automatic build, where you can see relevant information
(This page is limited to its own access, please replace the user name and warehouse name in the link with your own username and warehouse name)

Https://cloud.docker.com/app/huzhenghui/repository/docker/huzhenghui/sdkman/general

Once the setting is successful, the build is automatically triggered each time the code is submitted to the Https://github.com/huzhenghui/SDKMAN-Docker-Autobuild.
After the build is successful, you can see the exposed information in the mirrored warehouse

Https://hub.docker.com/r/huzhenghui/sdkman configuration Mirror Source

Now that the network is constrained to build, it also affects the pull mirror, where a faster mirror source can be used.
The more convenient is the Chinese University of Science and Technology provided by the mirror source, the document is

Http://mirrors.ustc.edu.cn/help/dockerhub.html

In this case, Boot2docker is used, and configuring the mirror source requires editing the file

Vi/var/lib/boot2docker/profile

Add rows in the following locations

  Extra_args= '
  --label provider=hyperv
+--registry-mirror=https://docker.mirrors.ustc.edu.cn
  '
  Cacert=/var/lib/boot2docker/ca.pem
  docker_host= '-H tcp://0.0.0.0:2376 '
  docker_storage=aufs
  DOCKER_ Tls=auto
  Serverkey=/var/lib/boot2docker/server-key.pem
  Servercert=/var/lib/boot2docker/server.pem

The modifications are shown below

Extra_args= '
--label provider=hyperv
--registry-mirror=https://docker.mirrors.ustc.edu.cn
'
Cacert=/var/lib/boot2docker/ca.pem
Docker_host= '-H tcp://0.0.0.0:2376 '
docker_storage=aufs
docker_tls=auto
serverkey=/var/lib/ Boot2docker/server-key.pem
Servercert=/var/lib/boot2docker/server.pem
Pull Mirror

Fast to fly.

Docker Pull Huzhenghui/sdkman

View Effects

Docker run-it--rm--entrypoint/bin/bash huzhenghui/sdkman-l-C ' SDK '

The output below indicates that it can function correctly

USAGE:SDK <command> [candidate] [version] SDK offline <enable|disable> Co
       Mmands:install or I <candidate> [version] Uninstall or RM <candidate> <version> List or LS [candidate] use or U <candidate> [version] default or D <candi
       date> [Version] current or C [candidate] upgrade or UG [candidate] version or V Broadcast or b Help or H offline [enable|disable] selfupdate [Force] upd ATE flush <candidates|broadcast|archives|temp> candidate:the SDK to Install:groovy, scal
                 A, grails, Gradle, Kotlin, etc. Use List command for comprehensive list of candidates eg: $ SDK list Version:where optional, de Faults to latest stable if not provided eg: $ SDK Install groovy 
Attention

Because the SDK is a function, the-l parameter is required

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.