我想将 docker compose 与主机网络一起使用。
我有一个访问本地 REST api 的 docker 容器。通常我跑
docker run --net=host -p 18080:8080 -t -i containera
Run Code Online (Sandbox Code Playgroud)
它可以访问在http://127.0.0.1:8080. 由于我想缩放容器,containera我发现 docker compose 可以缩放容器。但是文档中的 docker compose 文件不起作用。docker 容器不查询 REST API。
我尝试了以下撰写文件,但该属性
version: "3"
services:
web:
image: conatinera:latest
network_mode: "host"
deploy:
replicas: 1
resources:
limits:
cpus: "0.5"
memory: 4G
restart_policy:
condition: on-failure
ports:
- "18080:8080"
Run Code Online (Sandbox Code Playgroud)
但该属性network_mode被忽略/不允许。随着消息
Ignoring unsupported options: network_mode
Run Code Online (Sandbox Code Playgroud) 我想使用Nginx作为我的网络服务器和我自己的Dropwiward REST API,使用Vue.js构建单页面应用程序.此外,我使用Axios来调用我的REST请求.
我的nginx配置看起来像
server {
listen 80;
server_name localhost;
location / {
root path/to/vue.js/Project;
index index.html index.htm;
include /etc/nginx/mime.types;
}
location /api/ {
rewrite ^/api^/ /$1 break;
proxy_pass http://localhost:8080/;
}
}
Run Code Online (Sandbox Code Playgroud)
目前我可以打电话给我localhost/api/path/to/rescource从后端获取信息.
我用HTML和javascript(vue.js)构建前端,到目前为止已经工作了.但是,当我想构建单个页面应用程序时,大多数教程都提到了node.js. 我怎样才能使用Nginx?
我想用 minikube 公开我的 kubernetes 集群。
考虑我的树
.
??? deployment.yaml
??? Dockerfile
??? server.js
??? service.yaml
Run Code Online (Sandbox Code Playgroud)
我在本地构建了我的 docker 镜像,并且能够通过
kubectl create -f deployment.yaml
kubectl create -f service.yaml
Run Code Online (Sandbox Code Playgroud)
. 但是当我跑
$ kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 2h
nodeapp LoadBalancer 10.110.106.83 <pending> 80:32711/TCP 9m
Run Code Online (Sandbox Code Playgroud)
没有外部 ip 可以连接到集群。试图暴露一个 pod,但外部 Ip 没有。为什么没有外网ip?
$ cat deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nodeapp
labels:
app: nodeapp
spec:
replicas: 2
selector:
matchLabels:
app: nodeapp
template:
metadata:
labels:
app: …Run Code Online (Sandbox Code Playgroud) 我想读入两个带有数据的文本文件,并对我的Java Spark项目中的数据运行一些机器学习分类
设fileZero 和fileOne为包含以下格式数据的两个文件
>fileZero
10 1
9.8 1.2
10.1 0.9
....
Run Code Online (Sandbox Code Playgroud)
和其他文件
>fileOne
0.1 40
0.2 38
0 50
...
Run Code Online (Sandbox Code Playgroud)
对于fileZero和fileOne每行包含一个(x,y)元组,用空格隔开,分别标记为0和1。换句话说,fileZero应该将其中的所有行标记为0并标记为fileOne1。
我想阅读两个文件,并正在考虑使用该对象Dataset。如何读取两个文件,以后可以对数据进行分类/逻辑回归?
java machine-learning apache-spark spark-dataframe apache-spark-mllib
我想在我的 kubernetes 集群上部署入门镜像。
我在一个簇中有三个覆盆子
> kubectl version -o json ~
{
"clientVersion": {
"major": "1",
"minor": "18",
"gitVersion": "v1.18.2",
"gitCommit": "52c56ce7a8272c798dbc29846288d7cd9fbae032",
"gitTreeState": "clean",
"buildDate": "2020-04-16T11:56:40Z",
"goVersion": "go1.13.9",
"compiler": "gc",
"platform": "linux/arm"
},
"serverVersion": {
"major": "1",
"minor": "18",
"gitVersion": "v1.18.2",
"gitCommit": "52c56ce7a8272c798dbc29846288d7cd9fbae032",
"gitTreeState": "clean",
"buildDate": "2020-04-16T11:48:36Z",
"goVersion": "go1.13.9",
"compiler": "gc",
"platform": "linux/arm"
}
}
> docker -v ~
Docker version 19.03.8, build afacb8b
> kubectl get node ~
NAME STATUS ROLES AGE VERSION
master-pi4 Ready master 18h v1.18.2
node1-pi4 Ready …Run Code Online (Sandbox Code Playgroud) 我想使用 docker compose 作为部署在容器内运行带有 php 扩展的 apache Web 服务器。
我的撰写文件如下所示:
version: '3.1'
services:
php:
image: php:7.2-apache
ports:
- 8089:80
volumes:
- ./php/www:/var/www/html/
Run Code Online (Sandbox Code Playgroud)
我如何启用以下扩展。
apache2
php7.2
php-xdebug
php7.2-mcrypt
php-apcu
php-apcu-bc
php7.2-json
php-imagick
php-gettext
php7.2-mbstring
Run Code Online (Sandbox Code Playgroud) 我需要检查服务器是否支持SSL和Web服务器的密码.
我在Java中查看了SSLSocket,但我没有让它正常工作.
我使用的方法getSupportedProtocols()总是为每个网址提供相同的协议.此外,我没有得到从服务器给出的密码.我猜想getEnabledCipherSuites()这将是正确的方法
try {
SSLContext ctx = SSLContext.getDefault();
ctx.getClientSessionContext().setSessionTimeout(5); // in seconds
SSLSocket socket = (SSLSocket) ctx.getSocketFactory().createSocket("host.com", 443);
socket.setSoTimeout(5000); // in millis
String[] result = socket.getEnabledCipherSuites();
Arrays.sort(result);
for (int i = 0; i < result.length; i++) {
System.out.println(result[i]);
}
} catch (IOException ex) {
System.out.println("Error!");
}
Run Code Online (Sandbox Code Playgroud)
如何检查服务器是否使用SSL?从服务器返回了哪些密码?
我想在 dropwizard 中使用 Java/Jersey 中的对象列表获取内容 JSON 正文
考虑json主体
{
"tag1" : "value",
"parameter" : [
{
"name":"value1",
"content":"value2"
},
{
"name":"value1",
"content":"value2"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我试图接收请求
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response insertJob(
@PathParam("tag1")
String tag1,
@JsonProperty("parameter")
List<RequestParameter> parameter
) {
return Response.ok(parameter).build();
}
Run Code Online (Sandbox Code Playgroud)
但我只得到一个"message": "Unable to process JSON". 当我将正文更改为仅列表时
[
{
"name":"value1",
"content":"value2"
},
{
"name":"value1",
"content":"value2"
}
]
Run Code Online (Sandbox Code Playgroud)
和java代码
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response insertJob(
List<RequestParameter> parameter
) {
return Response.ok(parameter).build();
}
Run Code Online (Sandbox Code Playgroud)
我能够接收列表中的内容。如果列表有标签,我如何获取内容
java ×3
docker ×2
kubernetes ×2
apache-spark ×1
encryption ×1
jersey ×1
json ×1
nginx ×1
php ×1
ssl ×1
vue.js ×1