docker 一般用的都是apline镜像,不支持yum等工具,但是支持apk,用apk安装git 和ssh ,然后就可以开始拉代码做压测环境了
apk add git
apk update
apk list |grep golang
wget https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.10.3.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go version
git version
https://stackoverflow.com/questions/52056387/how-to-install-go-in-alpine-linux
https://blog.csdn.net/diyiday/article/details/80986025?utm_term=alpine%E5%AE%89%E8%A3%85git&utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~all~sobaiduweb~default-2-80986025&spm=3001.4430
https://wangchujiang.com/linux-command/c/apk.html
https://blog.csdn.net/liupeifeng3514/article/details/80418887
问题处理:
#1,error: cannot run ssh: No such file or directory
fatal: unable to fork
apk add ssh-client
https://stackoverflow.com/questions/4845937/error-cannot-run-ssh-no-such-file-or-directory
apk add openssh
https://stackoverflow.com/questions/35689976/installing-openssh-on-the-alpine-docker-container
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
https://blog.csdn.net/YanceChen2013/article/details/82218356
ssh-keygen -t rsa -C xiazemin@test.test
ssh -v git@git.test.test
ssh-agent -s
SSH_AUTH_SOCK=/tmp/ssh-txxzz/agent.787569; export SSH_AUTH_SOCK;
SSH_AGENT_PID=787570; export SSH_AGENT_PID;
echo Agent pid 787570;
ssh-add ~/.ssh/id_rsa
Could not open a connection to your authentication agent.
eval ssh-agent -s
SSH_AUTH_SOCK=/tmp/ssh-XcrxEhL6jgQM/agent.787783; export SSH_AUTH_SOCK;
SSH_AGENT_PID=787784; export SSH_AGENT_PID;
echo Agent pid 787784;
ssh-add ~/.ssh/id_rsa
Could not open a connection to your authentication agent.
The authenticity of host ‘github.com (13.250.177.223)’ can’t be established.
RSA key fingerprint is SHA256:x.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added ‘github.com,13.250.177.223’ (RSA) to the list of known hosts.
git@github.com: Permission denied (publickey).
ssh -T git@test.test
ssh: connect to host test.test port 22: Connection refused
git clone git@git.test.test:test/test.git
git checkout xiazemin/2021-05-10_sharedToMe
export PATH=$PATH:/usr/local/go/bin
go run main.go
2,main.go:4:2: cannot find package “go.uber.org/automaxprocs” in any of:
/usr/local/go/src/go.uber.org/automaxprocs (from $GOROOT)
/root/go/src/go.uber.org/automaxprocs (from $GOPATH)
go 版本太低
wget https://dl.google.com/go/go1.16.2.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.16.2.linux-amd64.tar.gz
go version
go version go1.16.2 linux/amd64
go get -u github.com/bojand/ghz/cmd/ghz
go get: module github.com/bojand/ghz/cmd/ghz: Get “https://proxy.golang.org/github.com/bojand/ghz/cmd/ghz/@v/list”: dial tcp 172.217.160.81:443: i/o .testeout
export GOPROXY=”https://goproxy.cn”
/usr/local/go/bin/go get -u -v github.com/bojand/ghz/cmd/ghz
/usr/local/go/src/run.teste/internal/atomic/atomic_amd64x.go:13:6: Load redeclared in this block
previous declaration at /usr/local/go/src/run.teste/internal/atomic/atomic_amd64.go:16:24
/usr/local/go/src/run.teste/internal/atomic/atomic_amd64x.go:19:6: Loadp redeclared in this block
previous declaration at /usr/local/go/src/run.teste/internal/atomic/atomic_amd64.go:22:32
/usr/local/go/src/run.teste/internal/atomic/atomic_amd64x.go:25:6: Load64 redeclared in this block
previous declaration at /usr/local/go/src/run.teste/internal/atomic/atomic_amd64.go:28:26
/usr/local/go/src/run.teste/internal/atomic/atomic_amd64x.go:30:6: Xadd redeclared in this block
previous declaration at /usr/local/go/src/run.teste/internal/atomic/atomic_amd64.go:51:37
/usr/local/go/src/run.teste/internal/atomic/atomic_amd64x.go:33:6: Xadd64 redeclared in this block
previous declaration at /usr/local/go/src/run.teste/internal/atomic/atomic_amd64.go:54:39
/usr/local/go/src/run.teste/internal/atomic/atomic_amd64x.go:36:6: Xadduintptr redeclared in this block
previous declaration at /usr/local/go/src/run.teste/internal/atomic/atomic_amd64.go:57:47
/usr/local/go/src/run.teste/internal/atomic/atomic_amd64x.go:39:6: Xchg redeclared in this block
previous declaration at /usr/local/go/src/run.teste/internal/atomic/atomic_amd64.go:60:36
/usr/local/go/src/run.teste/internal/atomic/atomic_amd64x.go:42:6: Xchg64 redeclared in this block
previous declaration at /usr/local/go/src/run.teste/internal/atomic/atomic_amd64.go:63:38
/usr/local/go/src/run.teste/internal/atomic/atomic_amd64x.go:45:6: Xchguintptr redeclared in this block
previous declaration at /usr/local/go/src/run.teste/internal/atomic/atomic_amd64.go:66:45
/usr/local/go/src/run.teste/internal/atomic/atomic_amd64x.go:48:6: And8 redeclared in this block
previous declaration at /usr/local/go/src/run.teste/internal/atomic/atomic_amd64.go:75:27
/usr/local/go/src/run.teste/internal/atomic/atomic_amd64x.go:48:6: too many errors
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.14.linux-amd64.tar.gz
老版本没有卸载干净
https://stackoverflow.com/questions/60447260/what-causes-this-run.teste-internal-error-about-previous-declaration-at-when-bui
rm -rf /usr/local/go
tar -C /usr/local -xzf go1.16.2.linux-amd64.tar.gz
export GOPATH=”/xiazemin”
export GOPROXY=”https://goproxy.cn”
/usr/local/go/bin/go get -u -v github.com/bojand/ghz/cmd/ghz
go: downloading github.com/bojand/ghz v0.95.0
./bin/ghz
call required
进入pod:
kubectl exec -ti
https://www.jianshu.com/p/493b65ee3194
kubectl exec -ti test-68c8c4d876-9q2j8 – /bin/sh
http://bluebiu.com/blog/iterm2-ssh-session-idle.html
https://www.cnblogs.com/hongdada/p/12066802.html
export GONOPROXY=”git.test.test”
export GOPROXY=”https://goproxy.cn”
/usr/local/go/bin/go run -tags musl main.go
pkg-config: exec: “pkg-config”: executable file not found in $PATH
apk add curl git pkgconfig && curl https://glide.sh/get | sh
https://github.com/confluentinc/confluent-kafka-go/issues/291
Package rdkafka was not found in the pkg-config search path.
Perhaps you should add the directory containing `rdkafka.pc’
to the PKG_CONFIG_PATH environment variable
Package ‘rdkafka’, required by ‘virtual:world’, not found
pkg-config: exit status 1
https://github.com/confluentinc/confluent-kafka-go/issues/224
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig/
https://github.com/confluentinc/confluent-kafka-go#getting-started
vi ~/.bash_rc
export PATH=$PATH:/usr/local/go/bin
export GOPATH=”/xiazemin”
export GOPROXY=”https://goproxy.cn”
export GONOPROXY=”git.test.test”
export PATH=$PATH:/xiazemin/bin
export PKG_CONFIG_PATH=”/usr/local/lib/pkgconfig/”
export CGO_ENABLED=1
source ~/.bash_rc
go build -tags musl ./…
Please specify at least one package name on the command line.
mkdir -p /usr/local/lib/pkgconfig/
export CGO_ENABLED=1
apk add bash
apk add gcc
apk add make
git clone https://github.com/edenhill/librdkafka.git
cd librdkafka
./configure
make
sudo make install
###########################################################
###########################################################
###########################################################
cxx (WITH_CXX) C++ compiler (c++)
module: cc
action: fail
reason:
command ‘c++ –version’ failed:
https://github.com/Blizzard/node-rdkafka/issues/263
apk add g++
http://www.jouypub.com/2019/74f51676e092598fe52b1def31cd8bc7/
apk add git
apk update
apk add openssh
apk add bash
apk add g++
apk add make
ssh-keygen -t rsa -C xiazemin@test.test
vi ~/.bash_rc
export PATH=$PATH:/usr/local/go/bin
export GOPATH=”/xiazemin”
export GOPROXY=”https://goproxy.cn”
export GONOPROXY=”git.test.test”
export PATH=$PATH:/xiazemin/bin
export PKG_CONFIG_PATH=”/usr/local/lib/pkgconfig/”
export CGO_ENABLED=1
source ~/.bash_rc
git clone git@git
go get -u github.com/bojand/ghz/cmd/ghz