我正在尝试构建映像并将容器作为 ssh 服务器运行。我希望能够从另一个容器 (jenkins/jenkins) ssh 该容器 (remote_host)
我正在使用带有 Centos 的 VM。
我正在使用这个 docker 文件。我从我的 VM 主机运行它(Centos 也是)
FROM centos
RUN yum -y install openssh-server openssh-clients
RUN useradd -ms /bin/bash remote_user && \
echo 'remote_user:12345' | chpasswd && \
mkdir /home/remote_user/.ssh && \
chmod 700 /home/remote_user/.ssh
COPY remote-key.pub /home/remote_user/.ssh/authorized_keys
RUN chown remote_user:remote_user -R /home/remote_user/.ssh && \
chmod 600 /home/remote_user/.ssh/authorized_keys
EXPOSE 22
RUN /usr/bin/ssh-keygen -A
CMD ["/usr/sbin/sshd", "-D"]
Run Code Online (Sandbox Code Playgroud)
我的 docker 撰写文件
---
networks:
net: ~
services:
jenkins:
container_name: jenkins
image: jenkins/jenkins
networks: …Run Code Online (Sandbox Code Playgroud) 我试图找到一种方法来避免与我在封闭流上读取的事实有关的IOException。
我正在调用返回流的webservice方法:
InputStream stream = callRestWebService();
try {
parkingState = objectMapper.readValue(stream, ParkingState.class);
} catch (IOException e) {
throw new ParkingMeasurementProviderException("Could not retrieve data.", e);
}
Run Code Online (Sandbox Code Playgroud)
然后,在关闭获取连接的地方使用Web Service方法:
public InputStream callRestWebService() {
int parkingId = 2803;
String endpointURL = REST_ENDPOINT + URI_INFO_PATH + parkingId + "/parkingState";
InputStream inputStream = null;
// Create an instance of HttpClient.
HttpClient httpclient = new HttpClient();
// Create a method instance.
GetMethod getMethod = new GetMethod(endpointURL);
getMethod.addRequestHeader("accept", "application/json");
try {
// Execute the method.
int statusCode …Run Code Online (Sandbox Code Playgroud) 我有一组我在Grails项目中执行的Spec测试.
当我在本地时,我需要执行一组规范,当我运行pre-prod环境时,我需要另一组Spec.我当前的配置同时为两个环境执行我的所有规格,这是我想要避免的.
我有多个环境,我在GebConfig中配置了:
environments {
local {
baseUrl = "http://localhost:8090/myApp/login/auth"
}
pre-prod {
baseUrl = "https://preprod/myApp/login/auth"
}
}
Run Code Online (Sandbox Code Playgroud) 我想找出学生练习的最热门(N)体育。n作为参数给出。
我已经分3个步骤完成了,但是我对解决方案不满意。我正在努力做到
这是我完整的代码和解决方案:
public class Person {
private UUID id;
private String name;
private List<Sport> sports = new ArrayList<>();
//getter and setters + constructor
}
Run Code Online (Sandbox Code Playgroud)
这是Class Sport:
public class Sport {
private String name;
public Sport(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的数据,也是提取前三项最受欢迎运动的逻辑:
public static void main(String[] args) {
// most popular sports
Sport football = new Sport("Football");
Sport tennis = new Sport("Tennis"); …Run Code Online (Sandbox Code Playgroud) 我是groovy的新手,我想知道如何在特定范围内的groovy中生成随机日期.我们假设从2013年6月到2014年6月.
谢谢
我正在尝试从包含以下内容的属性文件中提取用户名和密码:
#Fri May 31 09:33:22 CEST 2013
password=user40_31-05-2013
username=user40_31-05-2013
File propertiesFile = new File('testdata.properties')
def config = new ConfigSlurper().parse(propertiesFile.toURL())
println(config.username)
Run Code Online (Sandbox Code Playgroud)
我有这个错误:
期待'!',找到'F'@第1行,第2栏.#Fri May 31 09:33:22 CEST 2013 ^
1错误
提前致谢