如果使用idea编辑器的话,可以使用docker插件来远程使用服务器(虚拟机)上的docker,简单方便快捷的使用docker,更重要的是使用插件可以实现项目的一键部署,当然这还需要一些简单的配置。 默认的dokcer是不支持远程访问的,需要加点配置,开启Docker的远程访问
sudo vim /lib/systemd/system/docker.service
修改如下:
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target docker.socket 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
# 注释此行,复制一行 最后添加 -H tcp://0.0.0.0:2375 如果有防火墙 必须allow 2375端口
# ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.0:2375
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=infinit
# 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
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl status docker
#创建Demo.java
public class Demo {
public static void main(String[] args) {
System.out.println("hello woeld");
}
}
From ubuntu
Maintainer webrx <webrx@126.com>
Add jdk-18.tar.gz /usr/local/
Run mv /usr/local/jdk-18.0.1 /usr/local/jdk
Copy src/Demo.java /tmp
Env JAVA_HOME /usr/local/jdk
Env CLASSPATH .:$JAVA_HOME/lib
Env PATH .:$PATH:$JAVA_HOME/bin
Workdir /tmp
Volume /tmp
Run java Demo.java
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)