spotify / docker-maven-plugin

INACTIVE: A maven plugin for Docker
Apache License 2.0
2.67k stars 575 forks source link

Unrecognized token 'FROM': was expecting ('true', 'false' or 'null') #368

Closed Gulivert closed 6 years ago

Gulivert commented 6 years ago

Description

Hi! First of all thanks for your work. So... Im trying to create a Spring Cloud proyecto to up into a docker container. After resolve an error when wasn't able to find the docker file, (\<dockerConfigFile> ./DockerFile \</dockerConfigFile> do the thing), the console give me an error about parsing the DockerFile... weird thing couse is the same file from the "Complete" project

How to reproduce

Add the plugin to the pom, put the same file of the project "Complete" in my root, and give me an error

What do you expect

Doesn't give me this error

What happened instead

Give me the error: com.spotify.docker.client.shaded.com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'FROM': was expecting ('true', 'false' or 'null')

DockerFile FROM openjdk:8-jdk-alpine VOLUME /tmp ARG JAR_FILE ADD ${JAR_FILE} app.jar ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

Software:

Full backtrace

[WARNING] An attempt failed, will retry 1 more times
org.apache.maven.plugin.MojoExecutionException: Could not build image
    at com.spotify.plugin.dockerfile.BuildMojo.buildImage (BuildMojo.java:185)
    at com.spotify.plugin.dockerfile.BuildMojo.execute (BuildMojo.java:105)
    at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute (AbstractDockerMojo.java:240)
    at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute (AbstractDockerMojo.java:229)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: com.spotify.docker.client.exceptions.DockerException: com.spotify.docker.client.shaded.com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'FROM': was expecting ('true', 'false' or 'null')
 at [Source: C:\Git\NetvoteConfigServer\DockerFile; line: 1, column: 6]
    at com.spotify.docker.client.auth.ConfigFileRegistryAuthSupplier.authForBuild (ConfigFileRegistryAuthSupplier.java:102)
    at com.spotify.docker.client.auth.MultiRegistryAuthSupplier.authForBuild (MultiRegistryAuthSupplier.java:77)
    at com.spotify.docker.client.DefaultDockerClient.build (DefaultDockerClient.java:1388)
    at com.spotify.docker.client.DefaultDockerClient.build (DefaultDockerClient.java:1365)
    at com.spotify.plugin.dockerfile.BuildMojo.buildImage (BuildMojo.java:178)
    at com.spotify.plugin.dockerfile.BuildMojo.execute (BuildMojo.java:105)
    at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute (AbstractDockerMojo.java:240)
    at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute (AbstractDockerMojo.java:229)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: com.spotify.docker.client.shaded.com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'FROM': was expecting ('true', 'false' or 'null')
 at [Source: C:\Git\NetvoteConfigServer\DockerFile; line: 1, column: 6]
    at com.spotify.docker.client.shaded.com.fasterxml.jackson.core.JsonParser._constructError (JsonParser.java:1702)
    at com.spotify.docker.client.shaded.com.fasterxml.jackson.core.base.ParserMinimalBase._reportError (ParserMinimalBase.java:558)
    at com.spotify.docker.client.shaded.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidToken (UTF8StreamJsonParser.java:3528)
    at com.spotify.docker.client.shaded.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue (UTF8StreamJsonParser.java:2686)
    at com.spotify.docker.client.shaded.com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject (UTF8StreamJsonParser.java:878)
    at com.spotify.docker.client.shaded.com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken (UTF8StreamJsonParser.java:772)
    at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.ObjectMapper._initForReading (ObjectMapper.java:3834)
    at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose (ObjectMapper.java:3783)
    at com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.ObjectMapper.readTree (ObjectMapper.java:2431)
    at com.spotify.docker.client.DockerConfigReader.extractAuthJson (DockerConfigReader.java:115)
    at com.spotify.docker.client.DockerConfigReader.parseDockerConfig (DockerConfigReader.java:95)
    at com.spotify.docker.client.DockerConfigReader.fromConfig (DockerConfigReader.java:48)
    at com.spotify.docker.client.auth.ConfigFileRegistryAuthSupplier.authForBuild (ConfigFileRegistryAuthSupplier.java:100)
    at com.spotify.docker.client.auth.MultiRegistryAuthSupplier.authForBuild (MultiRegistryAuthSupplier.java:77)
    at com.spotify.docker.client.DefaultDockerClient.build (DefaultDockerClient.java:1388)
    at com.spotify.docker.client.DefaultDockerClient.build (DefaultDockerClient.java:1365)
    at com.spotify.plugin.dockerfile.BuildMojo.buildImage (BuildMojo.java:178)
    at com.spotify.plugin.dockerfile.BuildMojo.execute (BuildMojo.java:105)
    at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute (AbstractDockerMojo.java:240)
    at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute (AbstractDockerMojo.java:229)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)

Thanks!

aandac commented 6 years ago

+1

vijay-js commented 6 years ago

+1

mauro-dellachiesa commented 6 years ago

Same or similar problem here. I have specified a custom dockerConfigFile (Dockerfile.debug) and I'm getting the error that @Gulivert reported. The plugin works fine if I remove the dockerConfigFile configuration and let it use the default (Dockerfile).

kamila123 commented 6 years ago

Tried

FROM openjdk:8-jdk-alpine VOLUME /tmp ARG JAR_FILE ADD ${JAR_FILE} app.jar ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

thiagolsfortunato commented 6 years ago

I used <dockerDirectory>docker</dockerDirectory> and put Dockerfile inside this docker folder on root path of the my project.

groceryatdoorstep commented 6 years ago

Hi guys, i am facing the same problem here

kamila123 commented 6 years ago

I just put the Dockerfile inside the root folder and worked

davidxia commented 6 years ago

@Gulivert What's your docker-maven-plugin configuration in your pom.xml? Is this still an issue?

Gulivert commented 6 years ago

No sorry. We adopt another way to solve our problem with docker, but maybe otherone of the list could help you.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.