IntelliJには単純なHelloWorld Spring Bootアプリケーションがあります。リポジトリにプッシュするとDockerが認証エラーを表示する
これは私のコードです:
@Configuration
@ComponentScan
@EnableAutoConfiguration
@SpringBootApplication
public class App extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(App.class);
}
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
//takes input and navigates to that address
@RestController
class GreetingController {
@RequestMapping("/hello/{name}")
String hello(@PathVariable String name) {
return "Hello, welcome " + name + "!";
}
}
@RestController
class IndexController implements ErrorController {
private static final String PATH = "/error";
@RequestMapping(value = PATH)
public String error() {
return "You wanted to go to invalid URL. Please check again.";
}
@Override
public String getErrorPath() {
return PATH;
}
}
これは私の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>hllowrlddckr</groupId>
<artifactId>hllowrlddckr</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
</parent>
<dependencies>
<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>
</dependencies>
<properties>
<docker.image.prefix>springio</docker.image.prefix>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.2.3</version>
<configuration>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<dockerDirectory>src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
</project>
私はこのチュートリアルに従う:https://spring.io/guides/gs/spring-boot-docker/
私がドッキングウィンドウにこのアプリを展開するには、次チュートリアル、メイン/ドッカー/ドッカーファイルにドッカーファイルを作成しました
-e構築し、それがtryings後に正常に作成: は、その後のIntelliJ
MVNパッケージドッキングウィンドウの端にそれらのコマンドを実行しました。 Linuxのtermnalに私はドッカイメージを実行すると、私は次を参照してください。
sudo docker push springio/hllowrlddckr
が、それは、sudoでたりせずにエラーを与える:
docker images REPOSITORY TAG IMAGE ID CREATED SIZE springio/hllowrlddckr latest 0aa30f27c704 40 seconds ago 195.3 MB
チュートリアルによると、私はこれでそのレポにプッシュする必要があります。
sudo docker push springio/hllowrlddckr The push refers to a repository [docker.io/springio/hllowrlddckr] caa29c22a27c: Preparing 04e6743be3df: Preparing f3d2c9a5ee9f: Preparing 017f469bdc32: Preparing 4fe15f8d0ae6: Preparing unauthorized: authentication required
エラーは何ですか?
とは何ですか?frolvlad – fff
リポジトリの名前です。 https://hub.docker.com/u/frolvlad/から入手できます。 –
解決方法を見つけましたか? – BruceWayne