Blog

  • docker 网桥

    Docker 创建出来的每一个容器,都会创建一个虚拟的以太网设备(Veth 设备对),其中一端关联到网桥上,另一端使用 Linux 的网络命名空间技术,映射到容器内的 eth0 设备。

    以 CentOS 为例,安装工具

    yum install -y bridge-utils

    查看桥接

    brctl show
  • vim 获取当前目录及文件

    编辑文件时,需要经常知道当前目录及文件

    working directory

    pwd 
    

    打印当前文件

    :echo @%
    
  • vim 光标跳到首末字符

    跳到最后一个非空格字符

    g_          To the last non-blank character of the line and
                [count - 1] lines downward |inclusive|. {not in Vi}
    

    跳到第一个非空格字符

    ^
  • k8s 更新 docker image

    如果 docker tag 不一样

    kubectl set image deployment/myapp myapp=10.10.10.222:5000/myapp:v1.0.1 -n web
    

    如果 docker tag 一样,image digest 不一样,则更新 image 使用 digest

    查看 digest

    docker images --digests

    更新 image

    kubectl set image deployment/myapp myapp=10.10.10.222:5000/myapp@sha256:f9d3c70ca6eb35bf33077f308dc526472d21d80b0234121bc93ada58bce99ee9 -n web
  • govendor 使用

    install

    go get -u github.com/kardianos/govendor
    

    初始化

    govendor init
    govendor fetch +outside
    
  • go get 使用代理

    使用 go get , govendor fetch 遇到下面问题

    fatal: unable to access 'https://go.googlesource.com/net/': Server aborted the SSL handshake

    解决办法

    http_proxy=socks5://127.0.0.1:1080 govendor fetch +outside

    或者

    $ git config [--global] http.proxy http://proxy.example.com:port
    例如: git config --global http.proxy socks5://127.0.0.1:1080
    

    参考
    https://github.com/golang/go/wiki/GoGetProxyConfig