zoukankan      html  css  js  c++  java
  • rkt

    rkt

    1.安装rkt

    # wget https://github.com/rkt/rkt/releases/download/v1.30.0/rkt-v1.30.0.tar.gz
    # tar zxvf rkt-v1.30.0.tar.gz
    # cd rkt-v1.30.0
    # cp rkt /usr/local/bin
    

    2. 安装acbuild

    # wget https://github.com/containers/build/releases/download/v0.4.0/acbuild-v0.4.0.tar.gz
    # tar zxvf acbuild-v0.4.0.tar.gz
    # cd acbuild-v0.4.0
    # cp * /usr/local/bin
    

    3. 创建一个go镜像

    # mkdir hello
    # vi hello.go
    package main
    
    import (
    	"log"
    	"net/http"
    )
    
    func main() {
    	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
    		log.Printf("request from %v
    ", r.RemoteAddr)
    		w.Write([]byte("hello
    "))
    	})
    	log.Fatal(http.ListenAndServe(":5000", nil))
    }
    
    

    4. build

    CGO_ENABLED=0 go build -ldflags '-extldflags "-static"'
    

    5. 创建镜像

    acbuild begin
    acbuild set-name example.com/hello
    acbuild copy hello /bin/hello
    acbuild set-exec /bin/hello
    acbuild port add www tcp 5000
    acbuild label add version 0.0.1
    acbuild label add arch amd64
    acbuild label add os linux
    acbuild annotation add authors "Carly Container <carly@example.com>"
    acbuild write hello-0.0.1-linux-amd64.aci
    acbuild end
    

    6. run

    # rkt --insecure-options=image run hello-0.0.1-linux-amd64.aci
    

    报错:

    [root@node44 hello]# rkt --insecure-options=image run hello-0.0.1-linux-amd64.aci
    run: open /usr/lib/rkt/stage1-images/stage1-coreos.aci: no such file or directory
    

    解决:

    将rkt安装包中的aci结束的镜像拷贝到/usr/lib/rkt/stage1-images/中
    
  • 相关阅读:
    Func<T>、Action<T> 的区别于说明
    Invoke()/BeginInvoke()区别
    C# Linq处理list数据
    C# 的三种序列化方法
    P3368 【模板】树状数组 2
    P2058 海港
    2019.6.24 校内测试 NOIP模拟 Day 2 分析+题解
    2019.6.20 校内测试 NOIP模拟 Day 1 分析+题解
    2019.6.18 校内测试 分析+题解
    P1310 表达式的值
  • 原文地址:https://www.cnblogs.com/zhangjxblog/p/12168329.html
Copyright © 2011-2022 走看看