高校英文网站建设,为企业规划网站注意什么,江苏五星建设集团有限公司网站,山东临沂市建筑模板生产厂家idea远程连接docker
docker、ubuntu、linux、远程连接、IntelliJ idea注意#xff01;本文中开启docker远程连接的方法只能在确定环境安全的内网中使用#xff0c;不可在公网服务器设置#xff0c;有极大安全风险#xff01;
注意#xff01;本文中开启docker远程连接的…idea远程连接docker
docker、ubuntu、linux、远程连接、IntelliJ idea注意本文中开启docker远程连接的方法只能在确定环境安全的内网中使用不可在公网服务器设置有极大安全风险
注意本文中开启docker远程连接的方法只能在确定环境安全的内网中使用不可在公网服务器设置有极大安全风险
注意本文中开启docker远程连接的方法只能在确定环境安全的内网中使用不可在公网服务器设置有极大安全风险
步骤 vim /usr/lib/systemd/system/docker.service # set nu 打开行号找到第13行ExecStart在末尾添加-H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375如下 1 [Unit]2 DescriptionDocker Application Container Engine3 Documentationhttps://docs.docker.com4 Afternetwork-online.target docker.socket firewalld.service containerd.service time-set.target5 Wantsnetwork-online.target containerd.service6 Requiresdocker.socket78 [Service]9 Typenotify10 # the default is not to use systemd for cgroups because the delegate issues still11 # exists and systemd currently does not support the cgroup feature set required12 # for containers run by docker13 ExecStart/usr/bin/dockerd -H fd:// --containerd/run/containerd/containerd.sock -H unix:///var/run/docker.sock -H tcp://0.0.0.0:237514 ExecReload/bin/kill -s HUP $MAINPID15 TimeoutStartSec016 RestartSec217 Restartalways1819 # Note that StartLimit* options were moved from Service to Unit in systemd 229.20 # Both the old, and new location are accepted by systemd 229 and up, so using the old location21 # to make them work for either version of systemd.22 StartLimitBurst32324 # Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.25 # Both the old, and new name are accepted by systemd 230 and up, so using the old name to make26 # this option work for either version of systemd.27 StartLimitInterval60s2829 # Having non-zero Limit*s causes performance problems due to accounting overhead30 # in the kernel. We recommend using cgroups to do container-local accounting.31 LimitNPROCinfinity32 LimitCOREinfinity3334 # Comment TasksMax if your systemd version does not support it.35 # Only systemd 226 and above support this option.36 TasksMaxinfinity3738 # set delegate yes so that systemd does not reset the cgroups of docker containers39 Delegateyes4041 # kill only the docker process, not all processes in the cgroup42 KillModeprocess43 OOMScoreAdjust-5004445 [Install]46 WantedBymulti-user.target重启
systemctl daemon-reload
systemctl restart docker 重启后不要忘记把开发环境使用的MySQL和Redis容器启动起来
检查2375端口是否开放 ss -tuln使用curl连接一下 curl http://localhost:2375/version
{Platform:{Name:Docker Engine - Community},Components:[{Name:Engine,Version:26.0.0,Details:{ApiVersion:1.45,Arch:amd64,BuildTime:2024-03-20T15:17:51.00000000000:00,Experimental:false,GitCommit:8b79278,GoVersion:go1.21.8,KernelVersion:5.4.0-169-generic,MinAPIVersion:1.24,Os:linux}},{Name:containerd,Version:1.6.28,Details:{GitCommit:ae07eda36dd25f8a1b98dfbf587313b99c0190bb}},{Name:runc,Version:1.1.12,Details:{GitCommit:v1.1.12-0-g51d5e94}},{Name:docker-init,Version:0.19.0,Details:{GitCommit:de40ad0}}],Version:26.0.0,ApiVersion:1.45,MinAPIVersion:1.24,GitCommit:8b79278,GoVersion:go1.21.8,Os:linux,Arch:amd64,KernelVersion:5.4.0-169-generic,BuildTime:2024-03-20T15:17:51.00000000000:00}生成安全证书
执行下面这个脚本
#!/bin/bash#相关配置信息
SERVER192.168.56.10
PASSWORDvagrant
COUNTRYCN
STATEShan Dong
CITYJi Nan
ORGANIZATIONHuai Yin
ORGANIZATIONAL_UNITDev
EMAILxkm.0jiejie0qq.com###开始生成文件###
echo 开始生成文件#切换到生产密钥的目录
if [ ! -d /opt/docker_ca ]; then
mkdir -p /opt/docker_ca
fi
cd /opt/docker_ca
#生成ca私钥(使用aes256加密)
openssl genrsa -aes256 -passout pass:$PASSWORD -out ca-key.pem 4096
#生成ca证书填写配置信息
openssl req -new -x509 -passin pass:$PASSWORD -days 365 -key ca-key.pem -sha256 -out ca.pem -subj /C$COUNTRY/ST$STATE/L$CITY/O$ORGANIZATION/OU$ORGANIZATIONAL_UNIT/CN$SERVER/emailAddress$EMAIL#生成server证书私钥文件
openssl genrsa -out server-key.pem 4096
#生成server证书请求文件
openssl req -subj /CN$SERVER -sha256 -new -key server-key.pem -out server.csr
#配置白名单多个用逗号隔开
sh -c echo subjectAltName IP:$SERVER,IP:0.0.0.0 extfile.cnf
#把 extendedKeyUsage serverAuth 键值设置到extfile.cnf文件里限制扩展只能用在服务器认证
sh -c echo extendedKeyUsage serverAuth extfile.cnf
#使用CA证书及CA密钥以及上面的server证书请求文件进行签发生成server自签证书
openssl x509 -req -days 365 -sha256 -in server.csr -CA ca.pem -CAkey ca-key.pem -passin pass:$PASSWORD -\CAcreateserial -out server-cert.pem -extfile extfile.cnf#生成client证书RSA私钥文件
openssl genrsa -out key.pem 4096
#生成client证书请求文件
openssl req -subj /CNclient -new -key key.pem -out client.csr
#继续设置证书扩展属性
sh -c echo extendedKeyUsage clientAuth extfile.cnf
#生成client自签证书根据上面的client私钥文件、client证书请求文件生成
openssl x509 -req -days 365 -sha256 -in client.csr -CA ca.pem -CAkey ca-key.pem -passin pass:$PASSWORD -\CAcreateserial -out cert.pem -extfile extfile.cnf#更改密钥权限
chmod 0400 ca-key.pem key.pem server-key.pem
#更改密钥权限
chmod 0444 ca.pem server-cert.pem cert.pem
#删除无用文件
rm client.csr server.csrecho 生成文件完成
###生成结束### 修改Docker配置
# 打开docker配置文件 (这个和上面的是一个文件其使用了软链接路径不同而已不用纠结)vim /lib/systemd/system/docker.service
# 在ExecStart的/usr/bin/dockerd后面加\然后添加如下的配置信息
ExecStart/usr/bin/dockerd \--tlsverify \--tlscacert/opt/docker_ca/ca.pem \--tlscert/opt/docker_ca/server-cert.pem \--tlskey/opt/docker_ca/server-key.pem \-H tcp://0.0.0.0:2376 \-H unix:///var/run/docker.sock \-H fd:// --containerd/run/containerd/containerd.sock
# 重新启动dockersystemctl daemon-reload systemctl restart dockerctrlalts打开设置
Tools SSH Configurations点击输入IP、用户名、密码点击apply
配置idea客户端
将/opt/docker-ca目录下的ca.pem,cert.pem,key.pem我这复制了所有.pem文件懒得挑了复制到自己的电脑中某固定目录和虚拟机放在一起建个文件夹dockerFile
在idea设置中找到 Build,Execution,Deployment Docker点击连接方式选择TCP socket
url: https://192.168.56.10:2376 证书路径D:\dev\iso\dockerFile\dockerFile
可以看到下方提示 Connection successful
点击确定可以看到下方service窗口中出现了docker服务双击连接可以看到容器、镜像、网络、卷英文
点击具体容器实例的看板可以看到其版本配置信息 点击镜像可以在右侧框中输入镜像名称拉取镜像不知道为什么没有搜索功能可能是我没找到 这样一来用起docker要方便得多。
参考文章
声明本文使用八爪鱼rpa工具从gitee自动搬运本人原创或摘录会备注出处博客如版式错乱请评论私信如情况紧急或久未回复请致邮 xkm.0jiejie0qq.com 并备注原委引用本人笔记的链接正常情况下均可访问如打不开请查看该链接末尾的笔记标题右击链接文本点击 复制链接地址在文本编辑工具粘贴查看也可在搜索框粘贴后直接编辑然后搜索在本人博客手动搜索该标题即可如遇任何问题或有更佳方案欢迎与我沟通 文章转载自: http://www.morning.gmgnp.cn.gov.cn.gmgnp.cn http://www.morning.fqssx.cn.gov.cn.fqssx.cn http://www.morning.kkgbs.cn.gov.cn.kkgbs.cn http://www.morning.stxg.cn.gov.cn.stxg.cn http://www.morning.yrjfb.cn.gov.cn.yrjfb.cn http://www.morning.rwbx.cn.gov.cn.rwbx.cn http://www.morning.xgchm.cn.gov.cn.xgchm.cn http://www.morning.wphfl.cn.gov.cn.wphfl.cn http://www.morning.kfcfq.cn.gov.cn.kfcfq.cn http://www.morning.ghccq.cn.gov.cn.ghccq.cn http://www.morning.npfkw.cn.gov.cn.npfkw.cn http://www.morning.rqhn.cn.gov.cn.rqhn.cn http://www.morning.mkbc.cn.gov.cn.mkbc.cn http://www.morning.bpmfg.cn.gov.cn.bpmfg.cn http://www.morning.gjssk.cn.gov.cn.gjssk.cn http://www.morning.pdmc.cn.gov.cn.pdmc.cn http://www.morning.jxdhc.cn.gov.cn.jxdhc.cn http://www.morning.nrqnj.cn.gov.cn.nrqnj.cn http://www.morning.hhkzl.cn.gov.cn.hhkzl.cn http://www.morning.fjshyc.com.gov.cn.fjshyc.com http://www.morning.epeij.cn.gov.cn.epeij.cn http://www.morning.pfntr.cn.gov.cn.pfntr.cn http://www.morning.fstesen.com.gov.cn.fstesen.com http://www.morning.mpgfk.cn.gov.cn.mpgfk.cn http://www.morning.brmbm.cn.gov.cn.brmbm.cn http://www.morning.cybch.cn.gov.cn.cybch.cn http://www.morning.xxlz.cn.gov.cn.xxlz.cn http://www.morning.wfykn.cn.gov.cn.wfykn.cn http://www.morning.xqkjp.cn.gov.cn.xqkjp.cn http://www.morning.ssfq.cn.gov.cn.ssfq.cn http://www.morning.dtlnz.cn.gov.cn.dtlnz.cn http://www.morning.ndlww.cn.gov.cn.ndlww.cn http://www.morning.gnbtp.cn.gov.cn.gnbtp.cn http://www.morning.ymsdr.cn.gov.cn.ymsdr.cn http://www.morning.yghlr.cn.gov.cn.yghlr.cn http://www.morning.xfxlr.cn.gov.cn.xfxlr.cn http://www.morning.qnwyf.cn.gov.cn.qnwyf.cn http://www.morning.lrnfn.cn.gov.cn.lrnfn.cn http://www.morning.hlhqs.cn.gov.cn.hlhqs.cn http://www.morning.fhjnh.cn.gov.cn.fhjnh.cn http://www.morning.qnzgr.cn.gov.cn.qnzgr.cn http://www.morning.jbgzy.cn.gov.cn.jbgzy.cn http://www.morning.brwwr.cn.gov.cn.brwwr.cn http://www.morning.jfnbh.cn.gov.cn.jfnbh.cn http://www.morning.mpsnb.cn.gov.cn.mpsnb.cn http://www.morning.knqck.cn.gov.cn.knqck.cn http://www.morning.mqdr.cn.gov.cn.mqdr.cn http://www.morning.tzcr.cn.gov.cn.tzcr.cn http://www.morning.wkwds.cn.gov.cn.wkwds.cn http://www.morning.ysllp.cn.gov.cn.ysllp.cn http://www.morning.fywqr.cn.gov.cn.fywqr.cn http://www.morning.zyndj.cn.gov.cn.zyndj.cn http://www.morning.lkfsk.cn.gov.cn.lkfsk.cn http://www.morning.kpcjl.cn.gov.cn.kpcjl.cn http://www.morning.ypzr.cn.gov.cn.ypzr.cn http://www.morning.tldhq.cn.gov.cn.tldhq.cn http://www.morning.grxsc.cn.gov.cn.grxsc.cn http://www.morning.xhlpn.cn.gov.cn.xhlpn.cn http://www.morning.jtwck.cn.gov.cn.jtwck.cn http://www.morning.fchkc.cn.gov.cn.fchkc.cn http://www.morning.ylsxk.cn.gov.cn.ylsxk.cn http://www.morning.bfnbn.cn.gov.cn.bfnbn.cn http://www.morning.pzlcd.cn.gov.cn.pzlcd.cn http://www.morning.zwtp.cn.gov.cn.zwtp.cn http://www.morning.phtqr.cn.gov.cn.phtqr.cn http://www.morning.fjptn.cn.gov.cn.fjptn.cn http://www.morning.pfntr.cn.gov.cn.pfntr.cn http://www.morning.iiunion.com.gov.cn.iiunion.com http://www.morning.sbrpz.cn.gov.cn.sbrpz.cn http://www.morning.ygqhd.cn.gov.cn.ygqhd.cn http://www.morning.xppj.cn.gov.cn.xppj.cn http://www.morning.mstbbs.com.gov.cn.mstbbs.com http://www.morning.qyfqx.cn.gov.cn.qyfqx.cn http://www.morning.wflsk.cn.gov.cn.wflsk.cn http://www.morning.xpfwr.cn.gov.cn.xpfwr.cn http://www.morning.yjxfj.cn.gov.cn.yjxfj.cn http://www.morning.dytqf.cn.gov.cn.dytqf.cn http://www.morning.jjpk.cn.gov.cn.jjpk.cn http://www.morning.zlkps.cn.gov.cn.zlkps.cn http://www.morning.mytmx.cn.gov.cn.mytmx.cn