Docker:仅显示不支持的消息

时间:2018-10-19 06:33:16

标签: docker heroku docker-machine

我正在带有Linux容器的Windows上运行docker,并尝试将带有docker文件的spring boot项目推送到heroku。

Docker文件:

FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE
ADD ${JAR_FILE} forceCI-0.0.1-SNAPSHOT.jar
ENTRYPOINT [“java”,”-Djava.security.egd=file:/dev/./urandom”,”-jar”,”/forceCI-0.0.1-SNAPSHOT.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>com.forceCI</groupId>
    <artifactId>forceCI</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>forceCI</name>
    <description>Demo project for Spring Boot</description>

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

    <properties>
        <docker.image.prefix>forceci</docker.image.prefix>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jersey</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.restdocs</groupId>
            <artifactId>spring-restdocs-mockmvc</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/commons-httpclient/commons-httpclient -->
        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>4.4.9</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.json/json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20090211</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.kohsuke/github-api -->
        <dependency>
            <groupId>org.kohsuke</groupId>
            <artifactId>github-api</artifactId>
            <version>1.94</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.sparkjava/spark-core -->
        <dependency>
            <groupId>com.sparkjava</groupId>
            <artifactId>spark-core</artifactId>
            <version>2.8.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.ant/ant -->
        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <version>1.10.5</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.ant/ant-launcher -->
        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant-launcher</artifactId>
            <version>1.10.5</version>
        </dependency>



    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>


</project>

现在来自cli,我输入了以下内容。

heroku login
heroku container:login
heroku create forceci
docker build -t force_ci:v1 .

C:\ForceCI\forceCI\forceCI>docker images                
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
force_ci            v1                  36256495fa8f        26 seconds ago      150MB
openjdk             8-jdk-alpine        54ae553cb104        5 weeks ago         103MB

现在我做了heroku container:push web --app forceci

C:\ForceCI\forceCI\forceCI>heroku container:push web --app forceci         
=== Building web (C:\ForceCI\forceCI\forceCI\Dockerfile)
Sending build context to Docker daemon  47.44MB
Step 1/5 : FROM openjdk:8-jdk-alpine
 ---> 54ae553cb104
Step 2/5 : VOLUME /tmp
 ---> Using cache
 ---> 336a1d2d2af5
Step 3/5 : ARG JAR_FILE
 ---> Using cache
 ---> 1d5639ba8638
Step 4/5 : ADD ${JAR_FILE} forceCI-0.0.1-SNAPSHOT.jar
 ---> Using cache
 ---> 02d8baa57cfd
Step 5/5 : ENTRYPOINT [“java”,”-Djava.security.egd=file:/dev/./urandom”,”-jar”,”/forceCI-0.0.1-SNAPSHOT.jar”]
 ---> Using cache
 ---> 36256495fa8f
Successfully built 36256495fa8f
Successfully tagged registry.heroku.com/forceci/web:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions fo
r sensitive files and directories.
=== Pushing web (C:\ForceCI\forceCI\forceCI\Dockerfile)
The push refers to repository [registry.heroku.com/forceci/web]
39c03b6d47b3: Pushed
f2ec1bba02a6: Layer already exists
0c3170905795: Layer already exists
df64d3292fd6: Layer already exists
unsupported
 !    Error: docker push exited with 1

我得到了不支持的错误。

现在我做了docker镜像来检查已经构建了哪些镜像,我明白了:

C:\ForceCI\forceCI\forceCI>docker images                                   
REPOSITORY                        TAG                 IMAGE ID            CREATED             SIZE
force_ci                          v1                  36256495fa8f        6 minutes ago       150MB
registry.heroku.com/forceci/web   latest              36256495fa8f        6 minutes ago       150MB
openjdk                           8-jdk-alpine        54ae553cb104        5 weeks ago         103MB

然后我想将已经构建的图像推送到heroku,但是仍然收到不支持的消息。

C:\ForceCI\forceCI\forceCI>docker tag force_ci:v1 registry.heroku.com/forceci/web           

C:\ForceCI\forceCI\forceCI>docker push registry.heroku.com/forceci/web         
The push refers to repository [registry.heroku.com/forceci/web]
39c03b6d47b3: Layer already exists
f2ec1bba02a6: Layer already exists
0c3170905795: Layer already exists
df64d3292fd6: Layer already exists
unsupported

有人可以在这里帮忙吗?

日志文件显示:

[13:25:04.257][DnsUpdater     ][Info   ] Network configuration change detected
[13:25:04.257][PowerShell     ][Info   ] Run script '$(Find-NetRoute -RemoteIPAddress 8.8.8.8).InterfaceIndex[0]'...
[13:25:06.337][ApiProxy       ][Info   ] time="2018-10-22T13:25:06+05:30" msg="proxy >> GET /_ping\n"
[13:25:06.340][ApiProxy       ][Info   ] time="2018-10-22T13:25:06+05:30" msg="proxy << GET /_ping\n"
[13:25:06.846][ApiProxy       ][Info   ] time="2018-10-22T13:25:06+05:30" msg="proxy >> POST /v1.39/images/registry.heroku.com/forceci/web/push?tag=\n"
[13:25:09.988][VpnKit         ][Info   ] vpnkit.exe: Connected Ethernet interface f6:16:36:bc:f9:c6

[13:25:09.988][VpnKit         ][Info   ] vpnkit.exe: UDP interface connected on 52.218.80.36

[13:25:10.665][VpnKit         ][Error  ] vpnkit.exe: Socket.TCPv4.write tcp:52.218.80.36:443: caught Bad file descriptor returning Eof

[13:25:14.597][DnsUpdater     ][Info   ] Network configuration change detected
[13:25:14.597][PowerShell     ][Info   ] Run script '$(Find-NetRoute -RemoteIPAddress 8.8.8.8).InterfaceIndex[0]'...
[13:25:14.697][VpnKit         ][Info   ] vpnkit.exe: Connected Ethernet interface f6:16:36:bc:f9:c6

[13:25:14.697][VpnKit         ][Info   ] vpnkit.exe: UDP interface connected on 52.218.104.194

[13:25:16.019][VpnKit         ][Info   ] vpnkit.exe: Connected Ethernet interface f6:16:36:bc:f9:c6

[13:25:16.019][VpnKit         ][Info   ] vpnkit.exe: UDP interface connected on 52.218.49.108

[13:25:16.989][VpnKit         ][Info   ] vpnkit.exe: Connected Ethernet interface f6:16:36:bc:f9:c6

[13:25:16.989][VpnKit         ][Info   ] vpnkit.exe: UDP interface connected on 52.218.17.20

[13:25:18.064][VpnKit         ][Error  ] vpnkit.exe: Socket.TCPv4.write tcp:52.218.17.20:443: caught Bad file descriptor returning Eof

[13:25:22.592][VpnKit         ][Info   ] vpnkit.exe: Connected Ethernet interface f6:16:36:bc:f9:c6

[13:25:22.592][VpnKit         ][Info   ] vpnkit.exe: UDP interface connected on 52.218.53.170

[13:25:24.929][DnsUpdater     ][Info   ] Network configuration change detected
[13:25:24.929][PowerShell     ][Info   ] Run script '$(Find-NetRoute -RemoteIPAddress 8.8.8.8).InterfaceIndex[0]'...
[13:25:29.226][VpnKit         ][Info   ] vpnkit.exe: Connected Ethernet interface f6:16:36:bc:f9:c6

[13:25:29.226][VpnKit         ][Info   ] vpnkit.exe: UDP interface connected on 52.218.48.20

[13:25:31.233][ApiProxy       ][Info   ] time="2018-10-22T13:25:31+05:30" msg="proxy << POST /v1.39/images/registry.heroku.com/forceci/web/push?tag=\n"
[13:25:31.233][ApiProxy       ][Info   ] time="2018-10-22T13:25:31+05:30" msg="Cancel connection..."
[13:25:31.234][ApiProxy       ][Warning] time="2018-10-22T13:25:31+05:30" msg="ignored error: HvSocket has been closed for write"
[13:25:40.447][DnsUpdater     ][Info   ] Network configuration change detected
[13:25:40.447][PowerShell     ][Info   ] Run script '$(Find-NetRoute -RemoteIPAddress 8.8.8.8).InterfaceIndex[0]'...
[13:25:51.873][DnsUpdater     ][Info   ] Network configuration change detected
[13:25:51.873][PowerShell     ][Info   ] Run script '$(Find-NetRoute -RemoteIPAddress 8.8.8.8).InterfaceIndex[0]'...
[13:25:57.140][DnsUpdater     ][Info   ] Network configuration change detected
[13:25:57.140][PowerShell     ][Info   ] Run script '$(Find-NetRoute -RemoteIPAddress 8.8.8.8).InterfaceIndex[0]'...
[13:26:02.324][DnsUpdater     ][Info   ] Network configuration change detected
[13:26:02.324][PowerShell     ][Info   ] Run script '$(Find-NetRoute -RemoteIPAddress 8.8.8.8).InterfaceIndex[0]'...
[13:26:12.678][DnsUpdater     ][Info   ] Network configuration change detected
[13:26:12.678][PowerShell     ][Info   ] Run script '$(Find-NetRoute -RemoteIPAddress 8.8.8.8).InterfaceIndex[0]'...
[13:26:50.195][DnsUpdater     ][Info   ] Network configuration change detected
[13:26:50.195][PowerShell     ][Info   ] Run script '$(Find-NetRoute -RemoteIPAddress 8.8.8.8).InterfaceIndex[0]'...
[13:27:00.708][DnsUpdater     ][Info   ] Network configuration change detected
[13:27:00.708][PowerShell     ][Info   ] Run script '$(Find-NetRoute -RemoteIPAddress 8.8.8.8).InterfaceIndex[0]'...

2 个答案:

答案 0 :(得分:4)

我通过更改Dockerfile的最后一行来解决此问题。

最初,Visual Studio模板提供的文件使用以下内容在容器中启动Webapp:

ENTRYPOINT ["dotnet", "YourAppName.dll"]

相反,根据Heroku文档,您应该使用以下内容:

CMD ASPNETCORE_URLS=http://*:$PORT dotnet YourAppName.dll

现在,它就像一种魅力。

答案 1 :(得分:0)

您应将Dockerfile中的ENTRYPOINT替换为CMD。参见heroku docs

  

CMD是必需的。如果缺少CMD,注册表将返回错误   CMD将始终由外壳执行,以便使配置var可用于您的进程。要执行单个二进制文件或使用没有外壳的图像,请使用ENTRYPOINT