kubernetes 下载时间:228:228exec用户进程导致:没有这样的文件或目录

pu3pd22g  于 2023-01-12  发布在  Kubernetes
关注(0)|答案(4)|浏览(205)

每当我试图运行docker图像时,它会立即退出。

CONTAINER ID   IMAGE                      COMMAND                CREATED          STATUS                      PORTS     NAMES
ae327a2bdba3   k8s-for-beginners:v0.0.1   "/k8s-for-beginners"   11 seconds ago   Exited (1) 10 seconds ago             focused_booth

根据容器日志

standard_init_linux.go:228: exec user process caused: no such file or directory

我已经在linux中创建了所有的文件:

FROM alpine:3.10
COPY k8s-for-beginners /
CMD ["/k8s-for-beginners"]

GO代码:

package main

import (
    "fmt"
    "log"
    "net/http"
)

func main() {
    http.HandleFunc("/", handler)
    log.Fatal(http.ListenAndServe("0.0.0.0:8080", nil))
}

func handler(w http.ResponseWriter, r *http.Request) {
    log.Printf("Ping from %s", r.RemoteAddr)
    fmt.Fprintln(w, "Hello Kubernetes Beginners!")
}

这是《库伯内斯研讨会》一书中的第一个练习。
我在此过程中使用的命令:

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o k8s-for-beginners
sudo docker build -t k8s-for-beginners:v0.0.1 .
sudo docker run -p 8080:8080 -d k8s-for-beginners:v0.0.1

命令的输出:

sudo docker run k8s-for-beginners:v0.0.1 ldd /k8s-for-beginners
/lib64/ld-linux-x86-64.so.2 (0x7f9ab5778000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f9ab5778000)
Error loading shared library libgo.so.16: No such file or directory (needed by /k8s-for-beginners)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /k8s-for-beginners)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /k8s-for-beginners)
Error relocating /k8s-for-beginners: crypto..z2frsa..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fx509..import: symbol not found
Error relocating /k8s-for-beginners: log..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fmd5..import: symbol not found
Error relocating /k8s-for-beginners: crypto..import: symbol not found
Error relocating /k8s-for-beginners: bytes..import: symbol not found
Error relocating /k8s-for-beginners: fmt.Fprintln: symbol not found
Error relocating /k8s-for-beginners: crypto..z2felliptic..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fx509..z2fpkix..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2frand..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fchacha20poly1305..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fcurve25519..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fidna..import: symbol not found
Error relocating /k8s-for-beginners: internal..z2foserror..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fecdsa..import: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp.HandleFunc: symbol not found
Error relocating /k8s-for-beginners: io..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp2..z2fhpack..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fcipher..import: symbol not found
Error relocating /k8s-for-beginners: log.Fatal: symbol not found
Error relocating /k8s-for-beginners: math..z2fbig..import: symbol not found
Error relocating /k8s-for-beginners: runtime..import: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp..import: symbol not found
Error relocating /k8s-for-beginners: hash..z2fcrc32..import: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp.ListenAndServe: symbol not found
Error relocating /k8s-for-beginners: context..import: symbol not found
Error relocating /k8s-for-beginners: fmt..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2ftls..import: symbol not found
Error relocating /k8s-for-beginners: errors..import: symbol not found
Error relocating /k8s-for-beginners: internal..z2ftestlog..import: symbol not found
Error relocating /k8s-for-beginners: runtime.setIsCgo: symbol not found
Error relocating /k8s-for-beginners: runtime_m: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fhex..import: symbol not found
Error relocating /k8s-for-beginners: mime..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2funicode..z2fbidi..import: symbol not found
Error relocating /k8s-for-beginners: internal..z2freflectlite..import: symbol not found
Error relocating /k8s-for-beginners: compress..z2fgzip..import: symbol not found
Error relocating /k8s-for-beginners: sync..import: symbol not found
Error relocating /k8s-for-beginners: compress..z2fflate..import: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fbinary..import: symbol not found
Error relocating /k8s-for-beginners: math..z2frand..import: symbol not found
Error relocating /k8s-for-beginners: runtime_cpuinit: symbol not found
Error relocating /k8s-for-beginners: internal..z2fpoll..import: symbol not found
Error relocating /k8s-for-beginners: mime..z2fmultipart..import: symbol not found
Error relocating /k8s-for-beginners: runtime.check: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fcryptobyte..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha512..import: symbol not found
Error relocating /k8s-for-beginners: runtime.registerTypeDescriptors: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fchacha20..import: symbol not found
Error relocating /k8s-for-beginners: runtime.setmodinfo: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2ftransform..import: symbol not found
Error relocating /k8s-for-beginners: time..import: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fbase64..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha256..import: symbol not found
Error relocating /k8s-for-beginners: __go_go: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp..z2fhttpguts..import: symbol not found
Error relocating /k8s-for-beginners: path..z2ffilepath..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2fsecure..z2fbidirule..import: symbol not found
Error relocating /k8s-for-beginners: os..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp..z2fhttpproxy..import: symbol not found
Error relocating /k8s-for-beginners: net..z2ftextproto..import: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fasn1..import: symbol not found
Error relocating /k8s-for-beginners: runtime.requireitab: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fdns..z2fdnsmessage..import: symbol not found
Error relocating /k8s-for-beginners: path..import: symbol not found
Error relocating /k8s-for-beginners: io..z2fioutil..import: symbol not found
Error relocating /k8s-for-beginners: sort..import: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2funicode..z2fnorm..import: symbol not found
Error relocating /k8s-for-beginners: internal..z2fcpu..import: symbol not found
Error relocating /k8s-for-beginners: runtime.ginit: symbol not found
Error relocating /k8s-for-beginners: runtime.osinit: symbol not found
Error relocating /k8s-for-beginners: runtime.schedinit: symbol not found
Error relocating /k8s-for-beginners: bufio..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2finternal..z2frandutil..import: symbol not found
Error relocating /k8s-for-beginners: runtime_mstart: symbol not found
Error relocating /k8s-for-beginners: net..import: symbol not found
Error relocating /k8s-for-beginners: strconv..import: symbol not found
Error relocating /k8s-for-beginners: runtime.args: symbol not found
Error relocating /k8s-for-beginners: runtime..z2finternal..z2fsys..import: symbol not found
Error relocating /k8s-for-beginners: runtime.newobject: symbol not found
Error relocating /k8s-for-beginners: syscall..import: symbol not found
Error relocating /k8s-for-beginners: unicode..import: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp..z2finternal..import: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fpem..import: symbol not found
Error relocating /k8s-for-beginners: _Unwind_Resume: symbol not found
Error relocating /k8s-for-beginners: reflect..import: symbol not found
Error relocating /k8s-for-beginners: mime..z2fquotedprintable..import: symbol not found
Error relocating /k8s-for-beginners: log.Printf: symbol not found
Error relocating /k8s-for-beginners: runtime.typedmemmove: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fdsa..import: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha1..import: symbol not found
Error relocating /k8s-for-beginners: bufio..types: symbol not found
Error relocating /k8s-for-beginners: bytes..types: symbol not found
Error relocating /k8s-for-beginners: compress..z2fflate..types: symbol not found
Error relocating /k8s-for-beginners: compress..z2fgzip..types: symbol not found
Error relocating /k8s-for-beginners: context..types: symbol not found
Error relocating /k8s-for-beginners: crypto..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fcipher..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fdsa..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fecdsa..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2felliptic..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2finternal..z2frandutil..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fmd5..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2frand..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2frsa..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha1..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha256..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsha512..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2ftls..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fx509..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fx509..z2fpkix..types: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fasn1..types: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fbase64..types: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fbinary..types: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fhex..types: symbol not found
Error relocating /k8s-for-beginners: encoding..z2fpem..types: symbol not found
Error relocating /k8s-for-beginners: errors..types: symbol not found
Error relocating /k8s-for-beginners: fmt..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fchacha20..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fchacha20poly1305..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fcryptobyte..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fcurve25519..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fdns..z2fdnsmessage..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp..z2fhttpguts..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp..z2fhttpproxy..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fhttp2..z2fhpack..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fnet..z2fidna..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2fsecure..z2fbidirule..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2ftransform..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2funicode..z2fbidi..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2ftext..z2funicode..z2fnorm..types: symbol not found
Error relocating /k8s-for-beginners: hash..z2fcrc32..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fcpu..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2foserror..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fpoll..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2freflectlite..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2ftestlog..types: symbol not found
Error relocating /k8s-for-beginners: io..types: symbol not found
Error relocating /k8s-for-beginners: io..z2fioutil..types: symbol not found
Error relocating /k8s-for-beginners: log..types: symbol not found
Error relocating /k8s-for-beginners: math..z2fbig..types: symbol not found
Error relocating /k8s-for-beginners: math..z2frand..types: symbol not found
Error relocating /k8s-for-beginners: mime..types: symbol not found
Error relocating /k8s-for-beginners: mime..z2fmultipart..types: symbol not found
Error relocating /k8s-for-beginners: mime..z2fquotedprintable..types: symbol not found
Error relocating /k8s-for-beginners: net..types: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp..types: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp..z2finternal..types: symbol not found
Error relocating /k8s-for-beginners: net..z2ftextproto..types: symbol not found
Error relocating /k8s-for-beginners: os..types: symbol not found
Error relocating /k8s-for-beginners: path..types: symbol not found
Error relocating /k8s-for-beginners: path..z2ffilepath..types: symbol not found
Error relocating /k8s-for-beginners: reflect..types: symbol not found
Error relocating /k8s-for-beginners: runtime..types: symbol not found
Error relocating /k8s-for-beginners: runtime..z2finternal..z2fsys..types: symbol not found
Error relocating /k8s-for-beginners: sort..types: symbol not found
Error relocating /k8s-for-beginners: strconv..types: symbol not found
Error relocating /k8s-for-beginners: sync..types: symbol not found
Error relocating /k8s-for-beginners: syscall..types: symbol not found
Error relocating /k8s-for-beginners: time..types: symbol not found
Error relocating /k8s-for-beginners: unicode..types: symbol not found
Error relocating /k8s-for-beginners: container..z2flist..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2faes..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fdes..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fed25519..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fed25519..z2finternal..z2fedwards25519..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fhmac..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2finternal..z2fsubtle..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2frc4..types: symbol not found
Error relocating /k8s-for-beginners: crypto..z2fsubtle..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fcryptobyte..z2fasn1..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fhkdf..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2finternal..z2fsubtle..types: symbol not found
Error relocating /k8s-for-beginners: golang.x2eorg..z2fx..z2fcrypto..z2fpoly1305..types: symbol not found
Error relocating /k8s-for-beginners: hash..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fbytealg..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2ffmtsort..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fnettrace..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2frace..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fsingleflight..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fsyscall..z2fexecenv..types: symbol not found
Error relocating /k8s-for-beginners: internal..z2fsyscall..z2funix..types: symbol not found
Error relocating /k8s-for-beginners: math..types: symbol not found
Error relocating /k8s-for-beginners: math..z2fbits..types: symbol not found
Error relocating /k8s-for-beginners: net..z2fhttp..z2fhttptrace..types: symbol not found
Error relocating /k8s-for-beginners: net..z2furl..types: symbol not found
Error relocating /k8s-for-beginners: runtime..z2finternal..z2fatomic..types: symbol not found
Error relocating /k8s-for-beginners: runtime..z2finternal..z2fmath..types: symbol not found
Error relocating /k8s-for-beginners: strings..types: symbol not found
Error relocating /k8s-for-beginners: sync..z2fatomic..types: symbol not found
Error relocating /k8s-for-beginners: unicode..z2futf16..types: symbol not found
Error relocating /k8s-for-beginners: unicode..z2futf8..types: symbol not found
Error relocating /k8s-for-beginners: runtime.strequal..f: symbol not found
Error relocating /k8s-for-beginners: runtime.memequal64..f: symbol not found
Error relocating /k8s-for-beginners: type...1reflect.rtype: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Align: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Align: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.AssignableTo: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.AssignableTo: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Bits: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Bits: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.ChanDir: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.ChanDir: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Comparable: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Comparable: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.ConvertibleTo: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.ConvertibleTo: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Elem: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Elem: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Field: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Field: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldAlign: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldAlign: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByIndex: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByIndex: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByName: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByName: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByNameFunc: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.FieldByNameFunc: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Implements: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Implements: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.In: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.In: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.IsVariadic: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.IsVariadic: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Key: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Key: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Kind: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Kind: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Len: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Len: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Method: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Method: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.MethodByName: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.MethodByName: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Name: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Name: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumField: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumField: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumIn: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumIn: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumMethod: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumMethod: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumOut: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.NumOut: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Out: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Out: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.PkgPath: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.PkgPath: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Size: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.Size: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.String: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.String: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.common: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.common: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.rawString: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.rawString: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.uncommon..stub: symbol not found
Error relocating /k8s-for-beginners: reflect.rtype.uncommon..stub: symbol not found
Error relocating /k8s-for-beginners: reflect..reflect.rtype..d: symbol not found
Error relocating /k8s-for-beginners: type...1net.IPAddr: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.Network: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.Network: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.String: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.String: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.family: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.family: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.isWildcard: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.isWildcard: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.sockaddr: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.sockaddr: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.toLocal: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr.toLocal: symbol not found
Error relocating /k8s-for-beginners: net.IPAddr..d: symbol not found
Error relocating /k8s-for-beginners: runtime.main: symbol not found
Error relocating /k8s-for-beginners: runtime_iscgo: symbol not found
Error relocating /k8s-for-beginners: runtime_isstarted: symbol not found
Error relocating /k8s-for-beginners: runtime_isarchive: symbol not found
Error relocating /k8s-for-beginners: __gcc_personality_v0: symbol not found
Error relocating /k8s-for-beginners: io.Writer..d: symbol not found
Error relocating /k8s-for-beginners: runtime.writeBarrier: symbol not found
neskvpey

neskvpey1#

在我的特殊情况下,这个错误是由Windows/DOS行尾不正确的Bash入口脚本引起的。
将以下内容添加到Docker文件:

RUN dos2unix /entrypoint.sh

如果未安装dos2unix,请使用以下前缀:

# For Alpine Linux:
RUN apk add dos2unix
# For Ubuntu:
RUN apt-get install dos2unix
yftpprvb

yftpprvb2#

既然你已经在使用Docker了,我建议你使用multi-stage build .使用一个标准的docker映像,比如golang,你可以构建一个可执行的资产,它可以保证和其他docker linux映像一起工作:

FROM golang:1.17 as builder

# first (build) stage

WORKDIR /app
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 go build -o k8s-for-beginners

# final (target) stage

FROM alpine:3.10
COPY --from=builder /app/k8s-for-beginners /
CMD ["/k8s-for-beginners"]

注意:由于您使用的是CGO_ENABLED=0,因此可以在小得多的scratch容器中运行应用。为此,请将FROM alpine:3.10替换为FROM scratch
P.S.确保您在与Go源和Dockerfile相同的目录中有一个go.mod文件:

go mod init k8sapp     # creates a `go.mod`

也可以手动创建go.mod

module k8sapp

go 1.17
x4shl7ld

x4shl7ld3#

检查startup.sh文件结束字符LF而不是CRLF
enter image description here

qvk1mo1f

qvk1mo1f4#

错误standard_init_linux.go:228: exec user process caused: no such file or directory可能是由于动态链接器位于错误位置或不存在而导致的。
例如,编译一个简单的"hello world" test. cpp:

#include <cstdio>
int main(void)
{
    printf("Hello World!\n");
    return 0;
}
$ g++ test.cpp

检查可执行文件预期动态链接器的位置:

$ readelf -l a.out | grep -i interpreter
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]

下面是可能发生错误的地方:您希望从头开始创建一个最小容器映像,因此可以使用this之类的命令将所有库从ldd a.out复制到文件系统

$ ldd a.out | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp -v '{}' image_root/lib64
$ ldd a.out | grep '^\s*/' | awk '{print $1}' | xargs -I '{}' cp -v '{}' image_root/lib64
$ cp a.out image_root/bin/a.out
$ tar -C image_root -cvjSf image_root.tar.bz2 bin lib64

最后,使用容器文件/停靠文件:

FROM scratch
ADD image_root.tar.bz2 /
ENTRYPOINT ["/bin/a.out"]
$ podman build -t test -f Containerfile .
$ podman run --rm test
standard_init_linux.go:228: exec user process caused: no such file or directory

这个问题的解决方案是确保动态链接器放置在文件系统上的正确位置,因此在本例中创建文件系统时使用cp /lib64/ld-linux-x86-64.so.2 image_root/lib64/ld-linux-x86-64.so.2

相关问题