构建Dockerfile的问题

时间:2020-10-06 01:47:45

标签: docker go docker-compose dockerfile

temp <- read_sheet(url, sheet = "DATA", range = cell_cols("A:N"), col_types = 'c')

我得到的错误是这个。因此,我一直在尝试为Golang应用程序首次编写Dockerfile,这就是我遇到的问题。

RUN mkdir /app
WORKDIR /app

# We want to populate the module cache based on the go.{mod,sum} files.
COPY go.mod .
COPY go.sum .

RUN go mod download

COPY . .

# Build the Go app
RUN go build -o ./out/go-sample-app .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o main app/server.go

# This container exposes port 8080 to the outside world
EXPOSE 8080

# Run the binary program produced by `go install`
CMD ["go", "run, "server.go"]

文件结构就像

time="2020-10-06T07:03:55+05:30" level=error msg="Can't add file \\\\?\\D:\\0 NAT IT\\DumGo\\.git\\hooks\\update.sample to tar: io: read/write on closed pipe"
time="2020-10-06T07:03:55+05:30" level=error msg="Can't close tar writer: io: read/write on closed pipe"
error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&session=zuyf430dft91rrte7rvtw9kjg&shmsize=0&target=&ulimits=null&version=1: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

1 个答案:

答案 0 :(得分:0)

@divan_cyph确保您正在运行docker。您可以通过从cli执行docker info进行检查。

旁注,只需在COPY . .调用上方添加go mod download,然后同时删除COPY go.mod .COPY go.sum .

,就可以节省几行