草庐IT

docker-in-docker

全部标签

docker - 当 PIPE docker 中的输出时从 os.Stdin 读取时被阻止

我正在尝试将程序的输出(日志)通过管道传输到Go程序,该程序聚合/压缩输出并上传到S3。运行该程序的命令是“/program1|/logShipper”。logShipper是用Go编写的,它只是从os.Stdin读取并写入本地文件。本地文件将由另一个goroutine处理并定期上传到S3。有一些现有的docker日志驱动程序,但我们在完全托管的提供程序上运行容器并且日志处理费用非常昂贵,因此我们想绕过现有解决方案并直接上传到S3。logShipper的主要逻辑只是从os.Stdin读取并写入某个文件。它在本地机器上运行时工作正常,但在docker中运行时,goroutine在read

由于 : "go directory outside available modules",Docker 构建失败

我在构建我的go服务的Docker镜像时遇到问题(请参阅最后的错误消息)。我的服务代码结构如下:cmd-duc-adobepkg-adobe-common.gitignoreDockerfilego.modgo.sum这是我的Dockerfile:#buildimageFROMgolang:1.12-alpineasbuilderRUNapkupdate&&apkadd--no-cachegitca-certificates&&update-ca-certificatesWORKDIR/app#firstdownloaddependenciessothatwecanutilizethe

git - 如何在不终止连接的情况下更新 docker web 应用程序?

我有一个docker-compose.yml,它有两个服务:一个数据库和我的Go应用程序。我的CI/CD管道调用托管此docker容器的服务器并运行此bash脚本:gitfetch&>/dev/nulldiffs=$(gitdiffmasterorigin/master)if[!-z"$diffs"]thenecho"PullingcodefromGitHub..."gitcheckoutmastergitpulloriginmaster#updateserverdocker-composeup--build-d#killallunuseddockercontainersdockers

docker - 在 Dockerfile 和 docker-compose 中编写什么来传递本地包

我为服务器端api引入了带有gomodules的本地包。通过命令gorunmain.go,它在本地环境中运行良好,没有错误。但是在命令docker-composeup时不起作用。我想知道如何修复Dockerfile和docker-compose.yml。我在article目录下命令gomodinit。因此,它在go.mod中设置modulegithub.com/jpskgc/article。article├db├client├api│├main.go│├controller││└controller.go│└Dockerfile├nginx├docker-compose.yml├go.

shell - 无法使用exec在Go中为docker运行netstat

尝试使用exec在Go中运行终端命令以获取docker网络使用但无法。以下链接显示了如何使用终端获取docker容器的网络使用情况,它在终端中工作正常但不使用Go。https://docs.docker.com/config/containers/runmetrics/我得到退出代码1、2、125等,具有不同的组合。stdin,err:=cmd.StdinPipe()iferr!=nil{log.Fatal(err)}deferstdin.Close()io.WriteString(stdin,"CID="+CID)//containerIDio.WriteString(stdin,"

postgresql - Postgres 选择 WHERE col1, col2 IN 与 2d golang slice

我不确定如何使postgres查询2dslice中的where(col1,col2)我尝试了以下方法:`CREATETABLEtable2(idCHAR(27)NOTNULL,latFLOAT8NOTNULL,lonFLOAT8NOTNULL,PRIMARYKEY(id));latlongdata:=[][]float64{}latlongdata=append(latlongdata,[]float64{1.2,2.3},)latlongdata=append(latlongdata,[]float64{1.3,2.4},)..............................

amazon-web-services - golang in goland kinesis.GetRecordsInput is not found while 方法是?

为什么找不到GetRecordsInput?编译不通过的可能原因是什么?谢谢 最佳答案 Ohhhhhhhh,如果你有这样的变量kinesis:={whatever}好吧,你只是把自己搞砸了!!!但当然会增加困惑kinesis.GetRecords工作得很好。在我尝试一些古怪的东西并跳出框框思考之前,这花了我一个小时的时间来研究。咕噜咕噜。 关于amazon-web-services-golangingolandkinesis.GetRecordsInputisnotfoundwhile方

docker - 二进制文件是用 'CGO_ENABLED=0' 编译的,go-sqlite3 需要 cgo 才能工作。这是一个 stub

我想在Golang项目中使用sqlite3。但是在docker容器中运行它有一些错误。二进制文件是用'CGO_ENABLED=0'编译的,go-sqlite3需要cgo才能工作。这是一个stub这是我的构建脚本CGO_ENABLED=0GOOS=linuxGOARCH=amd64gobuild-omainmain.go我不能在mac电脑上使用CGO_ENABLED=1FROMgolang:1.13-alpineENVWORK_DIR=/goENVTIME_ZONE=Asia/SingaporeRUNln-snf/usr/share/zoneinfo/$TIME_ZONE/etc/loc

高语 : Allocating Slice of Slices in functions results in index out of range

我一直在用Go尝试一些东西,但遇到了一个我无法解决的问题。packagemainimport"fmt"import"strconv"funcwriteHello(iint,){fmt.Printf("hello,world"+strconv.Itoa(i)+"\n")}typeSliceStructstruct{data[][]int;}func(sSliceStruct)New(){s.data=make([][]int,10);}func(sSliceStruct)AllocateSlice(iint){s.data[i]=make([]int,10);}func(sSliceSt

go - 新手 : Properly sizing a []byte size in GO (Chunking)

新手警报!不太确定该怎么做-我想做一个“文件分块器”,我从二进制文件中抓取固定的slice,以便以后作为学习项目上传。我目前有这个:type(fileChunk[]bytefileChunks[]fileChunk)funcNumChunks(fios.FileInfo,chunkSizeint)int{chunks:=fi.Size()/int64(chunkSize)ifrem:=fi.Size()%int64(chunkSize)!=0;rem{chunks++}returnint(chunks)}//leftouterrchecksforbrevityfuncchunker(f