linuxkit 基本试用

安装

  • linux
go get -u github.com/linuxkit/linuxkit/src/cmd/linuxkit
  • mac
brew tap linuxkit/linuxkit
brew install --HEAD linuxkit

基本使用

  • yaml 定义文件(redis-os.yml)
# Minimal YAML to run a redis server (used at DockerCon'17)
# connect: nc localhost 6379
kernel:
  image: linuxkit/kernel:4.14.56
  cmdline: "console=tty0 console=ttyS0 console=ttyAMA0 console=ttysclp0"
init:
  - linuxkit/init:598439400c1e4bf8c25c63c98b2d3e83b1382be9
  - linuxkit/runc:v0.5
  - linuxkit/containerd:0784cc754edb296b996c3510abbdf69686ef0f24
onboot:
  - name: dhcpcd
    image: linuxkit/dhcpcd:v0.5
    command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
services:
  - name: getty
    image: linuxkit/getty:v0.5
    env:
     - INSECURE=true
  # Currently redis:4.0.6-alpine has trust issue with multi-arch
  # https://github.com/docker-library/official-images/issues/3794
  - name: redis
    image: redis:4.0.5-alpine
    capabilities:
     - CAP_NET_BIND_SERVICE
     - CAP_CHOWN
     - CAP_SETUID
     - CAP_SETGID
     - CAP_DAC_OVERRIDE
    net: host
trust:
  org:
    - linuxkit
    - library
  • 构建

    会有点慢,等待一会

linuxkit build  redis-os.yml
  • 运行
linuxkit run redis-os

效果

  • 构建结果
├── redis-os-cmdline
├── redis-os-initrd.img
├── redis-os-kernel
└── redis-os.yaml
  • 运行



参考资料

https://github.com/linuxkit/linuxkit
https://github.com/linuxkit/linuxkit/tree/master/examples

猜你喜欢

转载自www.cnblogs.com/rongfengliang/p/9354092.html
今日推荐