k8s或者docker使用debian系统的镜像,出现命令不存在如何解决

[root@k8s151 /k8s-manifests/deploy/wordpress/v3]$ kubectl exec -it wordpress-67b55b9d9-gv2p4 /bin/bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
root@wordpress-67b55b9d9-gv2p4:/var/www/html# ping
bash: ping: command not found

在/etc/docker目录下建立新文件daemon.json,并输入如下内容:

[root@k8s151 ~]$ cat /etc/docker/daemon.json 

{
  
  "dns":["8.8.8.8", "114.114.114.114"] #在daemon中配置dns
}
重启docker

[root@k8s151 ~]$ systemctl restart docker


然后进入到指定容器更新即可,

apt-get -y update  

apt install iputils-ping

你可能感兴趣的:(docker,kubernetes,运维)