Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker 部署失败 #31

Closed
mervynlam opened this issue Jun 30, 2023 · 2 comments
Closed

docker 部署失败 #31

mervynlam opened this issue Jun 30, 2023 · 2 comments

Comments

@mervynlam
Copy link

[root@mervyn MyUrls]# docker-compose up -d
[+] Building 136.5s (7/13)                                                                                                                                                                                                                                                    
 => [internal] load .dockerignore                                                                                                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                          0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                     0.0s
 => => transferring dockerfile: 389B                                                                                                                                                                                                                                     0.0s
 => [internal] load metadata for docker.io/library/golang:1.20-alpine                                                                                                                                                                                                   15.8s
 => CACHED [build 1/6] FROM docker.io/library/golang:1.20-alpine@sha256:fd9d9d7194ec40a9a6ae89fcaef3e47c47de7746dd5848ab5343695dbbd09f8c                                                                                                                                 0.0s
 => [internal] load build context                                                                                                                                                                                                                                        0.0s
 => => transferring context: 33.62kB                                                                                                                                                                                                                                     0.0s
 => CACHED [stage-1 1/3] WORKDIR /app                                                                                                                                                                                                                                    0.0s
 => ERROR [build 2/6] RUN apk update && apk add upx                                                                                                                                                                                                                    120.6s
------                                                                                                                                                                                                                                                                        
 > [build 2/6] RUN apk update && apk add upx:                                                                                                                                                                                                                                 
#0 0.215 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz                                                                                                                                                                                        
#0 60.38 WARNING: updating and opening https://dl-cdn.alpinelinux.org/alpine/v3.18/main: Permission denied                                                                                                                                                                    
#0 60.38 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/x86_64/APKINDEX.tar.gz
#0 120.5 WARNING: updating and opening https://dl-cdn.alpinelinux.org/alpine/v3.18/community: Permission denied
#0 120.5 4 unavailable, 0 stale; 16 distinct packages available
------
failed to solve: process "/bin/sh -c apk update && apk add upx" did not complete successfully: exit code: 4

docker版本

[root@mervyn MyUrls]# docker -v
Docker version 24.0.2, build cb74dfc
@mervynlam
Copy link
Author

docker版本换到23.0.3可以了。
Docker version 23.0.3, build 3e7cbfd

@mervynlam
Copy link
Author

docker版本换到23.0.3可以了。 Docker version 23.0.3, build 3e7cbfd

但是有另一个问题

 > [build 5/6] RUN go mod tidy:                                                                                                                                                                                                                                               
#0 0.272 go: downloading github.com/gin-gonic/gin v1.9.0                                                                                                                                                                                                                      
#0 0.274 go: downloading github.com/gomodule/redigo v2.0.0+incompatible                                                                                                                                                                                                       
#0 30.30 go: downloading github.com/sirupsen/logrus v1.9.0                                                                                                                                                                                                                    
#0 60.30 github.com/CareyWang/MyUrls imports                                                                                                                                                                                                                                  
#0 60.30 	github.com/gin-gonic/gin: github.com/gin-gonic/gin@v1.9.0: Get "https://proxy.golang.org/github.com/gin-gonic/gin/@v/v1.9.0.zip": dial tcp 172.217.163.49:443: i/o timeout
#0 60.30 github.com/CareyWang/MyUrls imports
#0 60.30 	github.com/gomodule/redigo/redis: github.com/gomodule/redigo@v2.0.0+incompatible: Get "https://proxy.golang.org/github.com/gomodule/redigo/@v/v2.0.0+incompatible.zip": dial tcp 172.217.163.49:443: i/o timeout
#0 60.30 github.com/CareyWang/MyUrls imports
#0 60.30 	github.com/sirupsen/logrus: github.com/sirupsen/logrus@v1.9.0: Get "https://proxy.golang.org/github.com/sirupsen/logrus/@v/v1.9.0.zip": dial tcp 142.251.42.241:443: i/o timeout
------
failed to solve: process "/bin/sh -c go mod tidy" did not complete successfully: exit code: 1

要在DockerfileRUN go mod tidy前加一行RUN go env -w GOPROXY=https://goproxy.cn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants