V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
annoygaga
V2EX  ›  程序员

如何科学的测试 docker image?

  •  
  •   annoygaga · Mar 20, 2023 · 2033 views
    This topic created in 1137 days ago, the information mentioned may be changed or developed.

    如题,主要是测试发布环节,当你 build image ,想确认这个 image 是能跑起来的(跑不起来也想拿到报错),同时监听了端口的,想问问这个情况下如何科学的确保这个过程呢?通过 Python 脚本的话呢?

    5 replies    2023-03-21 03:58:52 +08:00
    ShineyWang
        1
    ShineyWang  
       Mar 20, 2023
    你的服务弄一个 helthcheck
    run 之后根据 helthcheck 结果即可判断是不是成功的

    你的服务要是里面有错误,build 也不会知道问题的;所以只有 run 才是判断标准
    killva4624
        2
    killva4624  
       Mar 20, 2023
    测试环境每次 build 完之后直接发布,然后在新 pod running 的前提下跑一遍常用接口功能请求。
    caneman
        3
    caneman  
       Mar 20, 2023
    我一般是把容器跑起来后,经过一个延时,取容器的运行状态是不是 running 来判断容器是否能正常运行。
    Alias4ck
        4
    Alias4ck  
       Mar 20, 2023   ❤️ 1
    有个概念叫做 Container Structure Tests ( https://github.com/GoogleContainerTools/container-structure-test
    AbrahamGreyson
        5
    AbrahamGreyson  
       Mar 21, 2023
    可黑可白, 可以容器里写个脚本逐一检查, 也可以外部请求几个接口
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5633 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 06:30 · PVG 14:30 · LAX 23:30 · JFK 02:30
    ♥ Do have faith in what you're doing.