gpt4 book ai didi

java - jetty worker 。使用 dockerfile 创建镜像时出错

转载 作者:行者123 更新时间:2023-12-02 18:18:18 25 4
gpt4 key购买 nike

我需要容器化我的项目。我用 Intellij 理念 以及我在 intellij 终端中写的所有命令。我使用的命令:

$ mvn package
$ docker build -f Dockerfile -t week10 .

图像 hello-world 工作正常。
我创建了可执行的 jar 和 Dockerfile。当我输入创建图像的命令时,出现以下错误:

error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&do ckerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&session=jauqgloaecpwv5hch49bgfcak&shmsize=0&t=week10&target=&ulimits=null&version=1: open //./pipe/docker_en gine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.



Dockerfile :
FROM openjdk:8-jdk-alpine
ADD target/week10-1.0-SNAPSHOT.jar week10.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","week10.jar"]

pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>week10</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.2.6.RELEASE</version>
<configuration>
<finalName>week10</finalName>
<mainClass>com.fruitshop.Application</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<properties>
<start-class>com.fruitshop.Application</start-class>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>

你可以在这里看到我的整个项目: Project

我不知道我做错了什么。请指出问题是什么以及我如何解决它

最佳答案

该错误不是由 Dockerfile 引起的它与那部分有关:

In the default daemon configuration on Windows, the docker client must be run elevated to connect



您可以这样做以切换 Docker 守护进程:
  • 以管理员身份打开 Powershell
  • 运行以下命令:
  • cd "C:\Program Files\Docker\Docker"
    ./DockerCli.exe -SwitchDaemon

    关于java - jetty worker 。使用 dockerfile 创建镜像时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61062268/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com