Docker another tool: Linuxkit detailed explanation

Source: Internet
Author: User

Linuxkit This tool can be understood as the use of multiple docker images to form a minimized, customized operating system, customized system only dozens of M, with OpenStack and other cloud use will be very cool.

1. Installing Moby1

2. Create a linuxkit file 1

3. Production system 3

4. Use the mirror to enter the system 3

4.1 Creating a virtual machine using qemu 3

4.2 Creating a virtual machine using VirtualBox 4

1. Installing Moby

Production system needs to Moby This tool, the system has been installed on the premise of GO , execute the following command.

echo ' Export Gopath=/root/mobytool ' >>/etc/profile && mkdir-p/root/mobytool && cd/root/mobytool && go get-u github.com/linuxkit/linuxkit/src/cmd/moby && echo ' export path=/root/mobytoll/bin: $PATH ' & Gt;>/etc/profile

When the command is complete, no prompt is installed properly.

2. Create a linuxkit file

This file specifies what kind of system to combine, kernel, Init , Onboot , Services , Files This order cannot be changed. , see the following example:

[email protected] linuxkitdemo]# cat Linuxkitone.yml

Kernel

Image: "mobylinux/kernel:4.9.x" # Kernel Mirroring

CmdLine: "Console=ttys0 console=tty0 page_poison=1" # kernel command, can not be specified

Init: # the initial process, starting the system and some background containers, configuring the underlying file system mount, and so on.

-linuxkit/init:42fe8cb1508b3afed39eb89821906e3cc7a70551

-MOBYLINUX/RUNC:B0FB122E10DBB7E4E45115177A61A3F8D68C19A9

-Linuxkit/containerd:60e2486a74c665ba4df57e561729aec20758daed

-mobylinux/ca-certificates:eabc5a6e59f05aa91529d80e9a595b85b046f935

onboot: # System Services

-Name:sysctl

Image: "mobylinux/sysctl:2cf2f9d5b4d314ba1bfc22b2fe931924af666d8c"

Net:host

Pid:host

Ipc:host

Capabilities:

-Cap_sys_admin

Readonly:true

-NAME:BINFMT

Image: "linuxkit/binfmt:8881283ac627be1542811bd25c85e7782aebc692"

Binds:

-/proc/sys/fs/binfmt_misc:/binfmt_misc

Readonly:true

-NAME:DHCPCD

Image: "Linuxkit/dhcpcd:48e249ebef6a521eed886b3bce032db69fbb4afa"

Binds:

-/var:/var

-/tmp/etc:/etc

Capabilities:

-Cap_net_admin

-Cap_net_bind_service

-Cap_net_raw

Net:host

Command: ["/SBIN/DHCPCD", "--nobackground", "-F", "/dhcpcd.conf", "1"]

Services: # If you want some apps to start and run with the system, it's important to note that the startup of these services (that is, Docker containers) is out of order, and if there are dependencies that require additional processing.

-Name:rngd

Image: "Mobylinux/rngd:3dad6dd43270fa632ac031e99d1947f20b22eec9"

Capabilities:

-Cap_sys_admin

Oomscoreadj:-800

Readonly:true

-Name:nginx # service Name, custom

Image: "Nginx:alpine" # Docker image, Free choice

Capabilities: # the ability to give this service

-Cap_net_bind_service

-Cap_chown

-Cap_setuid

-Cap_setgid

-Cap_dac_override

Net:host # Specifies the network namespace, and host is the network namespace for the shared host.

Files

-Path:etc/docker/daemon.json

Contents: ' {' Debug ': true} '

Trust: # Add a trusted mirror or organization

Image

-Mobylinux/kernel

Outputs

-FORMAT:KERNEL+INITRD

-Format:iso-bios

-Format:iso-efi

# Specifies the output file type, the name defaults to the name of the. yml file, and "Moby Build" can also specify the image name with "--name" when creating the mirror; the types you can specify are:

L KERNEL+INITRD: Not sure when to use this format;

L Iso-bios: A CD image containing the traditional bios ;

L iso-efi: CD image containing the EFI BIOS for newer hardware;

L gcp-img: Compressed tar package format for Google Cloud Platform;

L gcp-storage: Related to Google Cloud Platform;

L GCP: Related to Google Cloud Platform ;

L Qcow,qcow2: Format for Qemu ;

L VHD:VHD Mirror;

L vmdk: A vmdk image for VmWare .

3. Production System

Put the above Linuxkit content in /opt/linuxkitdemo/linuxkitone.yml, then execute the following command,

cd/opt/linuxkitdemo/&& Moby Build Linuxkitone.yml

The execution of the process is slow, failed to execute more than a few times, after success will be in the/opt/linuxkitdemo/directory, the following files appear,

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/92/44/wKiom1j9vjWSk6GFAAAXOK9ySTc925.png "title=" Picture 1.png "alt=" Wkiom1j9vjwsk6gfaaaxok9ystc925.png "/>

these files are present because they are configured in the Linuxkitone.yml " outputs " type.

4. Use mirroring to enter the system

You can use the Qemu tool, or you can put the ISO file in vmware or VirtualBox to start.

4.1 Creating a virtual machine using qemu

/root/mobytool/src/github.com/linuxkit/linuxkit/scripts/qemu.sh/opt/linuxkitdemo/linuxkitone.iso

After creating the finished interface,

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/92/44/wKiom1j9vkvRrg3GAABfnQej748731.png "title=" Picture 2.png "alt=" Wkiom1j9vkvrrg3gaabfnqej748731.png "/>

4.2 Creating a virtual machine using VirtualBox

Using the generated image, creating a virtual machine with VMware is very slow; it was created in 1 minutes with VirtualBox , and the interface was similar to the above,

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/92/43/wKioL1j9vl7RuEdHAAAPCnX0C4g653.png "title=" Picture 3.png "alt=" Wkiol1j9vl7ruedhaaapcnx0c4g653.png "/>

Because the "services" configured in the LINUXKITONE.YML contains nginx, the nginx service is the boot state after entering the system.

Enter "halt" in the system to exit.



This article is from the "10536390" blog, please be sure to keep this source http://10546390.blog.51cto.com/10536390/1918913

Docker another tool: Linuxkit detailed explanation

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.