本文主要是介绍windows10下Linux子系统(ubuntu22.04) sshd docker kubectl,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
sshd
每次开机之后,启动sshd操作如下
mkdir /run/sshd
/usr/sbin/sshd
下载安装docker
wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.6.tgz
tar xf docker-20.10.6.tgz
chown -R root.root docker
cp docker/* /usr/bin/
groupadd docker
mkdir /var/lib/docker /etc/docker
配置文件
vim /etc/docker/daemon.json
{"storage-driver": "overlay2","registry-mirrors": ["https://q2gr04ke.mirror.aliyuncs.com"],"exec-opts": ["native.cgroupdriver=systemd"],"live-restore": true
}
启动dockerd
/usr/bin/dockerd
启动dockerd报错:
failed to start daemon: Error initializing network controller: error obtaining controller instance: unable to add return rule in DOCKER-ISOLATION-STAGE-1 chain: (iptables failed: iptables --wait -A DOCKER-ISOLATION-STAGE-1 -j RETURN: iptables v1.8.7 (nf_tables): RULE_APPEND failed (No such file or directory): rule in chain DOCKER-ISOLATION-STAGE-1
(exit status 4))
解决:
切换到legacy iptables:如果你的系统使用的是nftables作为默认的防火墙管理工具,Docker可能会因为与iptables的兼容性问题
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
最后启动dockerd
nohup /usr/bin/dockerd &
安装kubectl
apt update && apt install -y apt-transport-https curl
curl -fsSL https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
EOFapt update
apt install -y kubectl
也可以下载二进制kubectl
curl -LO "https://cdn.dl.k8s.io/release/v1.20.3/bin/linux/amd64/kubectl"
这篇关于windows10下Linux子系统(ubuntu22.04) sshd docker kubectl的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!