Idea:连接Docker服务器
目录
基础环境
Docker开启远程API
修改docker.service文件
配置生效
重新启动Docker服务
开启2375端口
测试—curl http://192.168.172.128:2375/version
Idea 集成Docker
问题:
idea 底层显示docker窗口
基础环境
Idea: 2019.1.3
Docker: 20.10.2
Centos: 7.8
Docker开启远程API
修改docker.service文件
vim /usr/lib/systemd/system/docker.service
需要修改的部分:
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
修改后的部分:
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
配置生效
systemctl daemon-reload
重新启动Docker服务
systemctl stop docker
systemctl start docker
开启2375端口
firewall-cmd --zone=public --add-port=2375/tcp --permanent
firewall-cmd --reload
测试—curl http://192.168.172.128:2375/version
[root@localhost devicemag]# vim /usr/lib/systemd/system/docker.service
[root@localhost devicemag]# systemctl daemon-reload
[root@localhost devicemag]# systemctl stop docker
Warning: Stopping docker.service, but it can still be activated by:
docker.socket
[root@localhost devicemag]# systemctl start docker
[root@localhost devicemag]# curl http://192.168.172.128:2375/version
{"Platform":{"Name":"Docker Engine - Community"},"Components":[{"Name":"Engine","Version":"20.10.2","Details":{"ApiVersion":"1.41","Arch":"amd64","BuildTime":"2020-12-28T16:16:13.000000000+00:00","Experimental":"false","GitCommit":"8891c58","GoVersion":"go1.13.15","KernelVersion":"3.10.0-1160.el7.x86_64","MinAPIVersion":"1.12","Os":"linux"}},{"Name":"containerd","Version":"1.4.3","Details":{"GitCommit":"269548fa27e0089a8b8278fc4fc781d7f65a939b"}},{"Name":"runc","Version":"1.0.0-rc92","Details":{"GitCommit":"ff819c7e9184c13b7c2607fe6c30ae19403a7aff"}},{"Name":"docker-init","Version":"0.19.0","Details":{"GitCommit":"de40ad0"}}],"Version":"20.10.2","ApiVersion":"1.41","MinAPIVersion":"1.12","GitCommit":"8891c58","GoVersion":"go1.13.15","Os":"linux","Arch":"amd64","KernelVersion":"3.10.0-1160.el7.x86_64","BuildTime":"2020-12-28T16:16:13.000000000+00:00"}
[root@localhost devicemag]# firewall-cmd --zone=public --add-port=2375/tcp --permanent
success
[root@localhost devicemag]# firewall-cmd --reload
Idea 集成Docker
在IDEA中打开File -> Settings菜单,在插件市场中搜索Docker插件,并安装
Docker插件
配置连接Docker服务端
连接成功,如下所示
问题:
idea 底层显示docker窗口
IDEA顶部工具栏的View–>Tool Windows–>Docker
/usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service containerd.service
Wants=network-online.target
Requires=docker.socket containerd.service
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
#ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
# Both the old, and new location are accepted by systemd 229 and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst=3
# Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Comment TasksMax if your systemd version does not support it.
# Only systemd 226 and above support this option.
TasksMax=infinity
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
OOMScoreAdjust=-500
[Install]
WantedBy=multi-user.target
还没有评论,来说两句吧...