init commit
This commit is contained in:
59
archive/docs/docker&k8s/远程调试.md
Normal file
59
archive/docs/docker&k8s/远程调试.md
Normal file
@ -0,0 +1,59 @@
|
||||
> 在虚拟机内进行调试,肯定没有本机的wsl和docker那么方便,不过总是有办法的
|
||||
|
||||
### VSCode
|
||||
> vscode 提供了远程连接的插件`Visual Studio Code Remote - SSH`
|
||||
|
||||
然后新建一个连接就好了,然后新建的vscode就完全处在远程的环境中了
|
||||
|
||||

|
||||
config内容:
|
||||
```bash
|
||||
# Read more about SSH config files: https://linux.die.net/man/5/ssh_config
|
||||
Host centos
|
||||
HostName 虚拟机ip
|
||||
User root
|
||||
```
|
||||
|
||||
然后比较烦的就是每次打开都需要输入密码,我们可以用我们的公钥登录(git那个)
|
||||
```bash
|
||||
mkdir .ssh
|
||||
chmod 700 .ssh/
|
||||
touch ~/.ssh/authorized_keys
|
||||
chmod 600 ~/.ssh/authorized_keys
|
||||
vi ~/.ssh/authorized_keys
|
||||
### 这里我们直接吧id_rsa.pub复制粘贴上传上去- -...用xshell之类的工具去粘贴
|
||||
```
|
||||
config后面增加`IdentityFile`,然后就完事了
|
||||
```bash
|
||||
# Read more about SSH config files: https://linux.die.net/man/5/ssh_config
|
||||
Host centos
|
||||
HostName 虚拟机ip
|
||||
User root
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
```
|
||||
|
||||
不过就是还要重新建立环境
|
||||
|
||||
### docker(vscode)
|
||||
安装微软的那个docker插件,然后进入首选项,修改如下配置
|
||||
HI6]~QXP33OMNWYSAF.png)
|
||||
|
||||
在虚拟机中允许docker远程访问
|
||||
```bash
|
||||
vi /usr/lib/systemd/system/docker.service
|
||||
### 修改文件
|
||||
[Service]
|
||||
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375 --containerd=/run/containerd/containerd.sock
|
||||
### 上面这一行,主要是增加了`-H tcp://0.0.0.0:2375`
|
||||
systemctl daemon-reload
|
||||
systemctl restart docker
|
||||
### 如果连不上,关闭防火墙,直接关!
|
||||
systemctl stop firewalld
|
||||
### 算了,只打开docker的端口
|
||||
firewall-cmd --zone=public --add-port=2375/tcp --permanent
|
||||
```
|
||||
|
||||
### idea系列
|
||||

|
||||
直接上图
|
||||
|
Reference in New Issue
Block a user