Giter VIP home page Giter VIP logo

Comments (5)

toranger avatar toranger commented on August 12, 2024

这里是怎么配置的呢,我拿内网环境试了下是可以的
_20181217211220

from cos-go-sdk-v5.

hyacinthus avatar hyacinthus commented on August 12, 2024

可能和 docker 有关系,我用的 debian 镜像。 等我去做个demo 。

from cos-go-sdk-v5.

hyacinthus avatar hyacinthus commented on August 12, 2024

@tomleader
我用你这个demo,做了个镜像。
https://github.com/hyacinthus/cos-go-sdk-v5/blob/master/example/object/Dockerfile
代码和镜像都在这里

下边是运行时的截图

➜  xbswarm git:(master) ✗ sh test.sh
Unable to find image 'hub.tencentyun.com/muninn/costest:latest' locally
latest: Pulling from muninn/costest
54f7e8ac135a: Already exists 
06be90607741: Pull complete 
Digest: sha256:07ff03fd79892259f3d65597bf0107dc840e2d98bd8dba3b2111d3acdf12ab4e
Status: Downloaded newer image for hub.tencentyun.com/muninn/costest:latest
GET /test.txt HTTP/1.1
Host: static-xxx.cos.ap-shanghai.myqcloud.com
User-Agent: cos-go-sdk-v5/0.7.3
Authorization: q-sign-algorithm=sha1&q-ak=xxx&q-sign-time=1545062023;1545065623&q-key-time=1545062023;1545065623&q-header-list=content-type&q-url-param-list=&q-signature=xxx
Content-Type: application/xml
Accept-Encoding: gzip



panic: Get https://static-xxx.cos.ap-shanghai.myqcloud.com/test.txt: x509: certificate signed by unknown authority

goroutine 1 [running]:
main.main()
	/app/get.go:36 +0x7c8

大家用golang一般都是在docker里的,我在服务器上还真没装golang环境,也没法直接试验。

from cos-go-sdk-v5.

toranger avatar toranger commented on August 12, 2024

嗯,那可以先排除下是否是docker环境的因素,在内网装个go的amd包跑程序试下,明天我也试下docker环境的

from cos-go-sdk-v5.

hyacinthus avatar hyacinthus commented on August 12, 2024

不好意思,经过这么一对比,刚又琢磨了一会,想起来我遇到过的这个坑。
虽然走的内网但是cvm是能连外网的,应该是能验证签名的呀。
于是想起来 debian 的裸镜像是没预装证书的。
需要在 dockerfile 里自己装 ca-certificates 这个包。

...
FROM debian

RUN apt-get update \
    && apt-get install -y -q --no-install-recommends \
    ca-certificates \
    && apt-get clean \
    && rm -r /var/lib/apt/lists/*

ENV TZ=Asia/Shanghai

COPY --from=build-env /app/app /usr/bin/app

CMD ["app"]

ps. 一不小心忘记隐藏ak了,只能重新生成一个。。。

from cos-go-sdk-v5.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.