каталог проекта
Я следовал этому руководству: https://www.educative.io/answers/how-do ... ckerize-a- maven-project, и у меня нет проблем до установки mvn.
Затем, когда я пытаюсь выполнить сборку докера, я получаю следующую ошибку:
Код: Выделить всё
------
> [2/2] ADD target/simple-docker.jar simple-docker.jar:
------
Dockerfile:21
--------------------
19 |
20 | FROM openjdk:8
21 | >>> ADD target/simple-docker.jar simple-docker.jar
22 | ENTRYPOINT ["java", "-jar","simple-docker.jar"]
23 | EXPOSE 8080
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 98866f48-ea55-426c-80eb-d2380731e691::i1dew1l2luwxdy8xrwia5eytv: "/target/simple-docker.jar": not found
Код: Выделить всё
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
FROM openjdk:8
ADD target/simple-docker.jar simple-docker.jar
ENTRYPOINT ["java", "-jar","simple-docker.jar"]
EXPOSE 8080
Код: Выделить всё
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
org.apache.commons
commons-parent
77
4.0.0
commons-daemon
commons-daemon
1.4.1-SNAPSHOT
Apache Commons Daemon
2002
Apache Commons Daemon software is a set of utilities and Java support
classes for running Java applications as server processes. These are
commonly known as 'daemon' processes in Unix terminology (hence the
name). On Windows they are called 'services'.
https://commons.apache.org/proper/commons-daemon/
jira
https://issues.apache.org/jira/browse/DAEMON
scm:git:https://gitbox.apache.org/repos/asf/commons-daemon.git
scm:git:https://gitbox.apache.org/repos/asf/commons-daemon.git
https://gitbox.apache.org/repos/asf?p=commons-daemon.git
Jean-Frederic Clere
jfclere
jfclere at apache.org
Remy Maucherat
remm
remm at apache.org
Yoav Shapira
yoavs
yoavs at apache.org
Bill Barker
billbarker
billbarker at apache.org
Mladen Turk
mturk
mturk at apache.org
Pier Fumagalli
pier
pier at apache.org
ggregory
Gary Gregory
ggregory at apache.org
https://www.garygregory.com
The Apache Software Foundation
https://www.apache.org/
PMC Member
America/New_York
https://people.apache.org/~ggregory/img/garydgregory80.png
Nick Griffiths
nicobrevin@gmail.com
org.junit.jupiter
junit-jupiter
test
java18
1.8
${commons.daemon.javaversion}
${commons.daemon.javaversion}
daemon
org.apache.commons.daemon
1.4.1
RC1
1.4.0
DAEMON
12310468
2024-01-01T00:00:00Z
true
true
0.01
0.00
0.01
0.00
0.00
0.00
release
simple-docker
org.apache.commons
commons-release-plugin
detatch-distributions
none
clean verify apache-rat:check japicmp:cmp pmd:check pmd:cpd-check javadoc:javadoc
org.apache.rat
apache-rat-plugin
src/native/unix/configure
src/native/unix/support/config.guess
src/native/unix/support/config.sub
src/native/unix/config.nice
src/native/unix/config.status
src/native/unix/config.log
com.github.spotbugs
spotbugs-maven-plugin
maven-assembly-plugin
src/assembly/native-src.xml
src/assembly/bin.xml
src/assembly/src.xml
src/assembly/win.xml
gnu
org.apache.maven.plugins
maven-jar-plugin
3.4.2
true
lib/
org.apache.commons.daemon.Docker.example
maven-deploy-plugin
org.apache.commons
commons-release-plugin
detach-distributions
deploy
detach-distributions
- Путь к классу
- Одно и единственное предупреждение при установке mvn:
[ПРЕДУПРЕЖДЕНИЕ] Файл commons-daemon-1.4.1-SNAPSHOT.jar уже является модульным. - пример кода класса:
Код: Выделить всё
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.daemon.Docker;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
public class example
{
public static void main( String[] args ) throws IOException {
HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0);
server.createContext("/", new MyHandler());
server.setExecutor(null); // creates a default executor
server.start();
}
static class MyHandler implements HttpHandler {
@Override
public void handle(HttpExchange t) throws IOException {
String response = " Hello World!!!! I just Dockerized a Maven Project ";
t.sendResponseHeaders(200, response.length());
OutputStream os = t.getResponseBody();
os.write(response.getBytes());
os.close();
}
}
}
Спасибо
Подробнее здесь: https://stackoverflow.com/questions/791 ... en-project
Мобильная версия