我已经关注了Matt Raible的帖子https://developer.okta.com/blog/2017/06/20/develop-microservices-with-jhipster ...我在本地机器上运行docker-compose时遇到错误。
向我显示的错误是:
➜~cdwork / jhipster / microservices / docker
➜泊坞木码头组成
Building store-mongodb-node Step 1/2 : FROM mongo:3.4.8 ---> 917819fa18fd Step 2/2 : ADD mongodb/scripts/init_replicaset.js init_replicaset.js ERROR: Service 'store-mongodb-node' failed to build: ADD failed: stat /var/lib/docker/tmp/docker-builder345385260/mongodb/scripts/init_replicaset.js: no such file or directory
我用mongodb创建了商店微服务。
我跑了./mvnw -Pprod dockerfile:在商店,博客项目中构建。 (因为docker:build plugin不存在)
JHipster版本:v4.8.0
Docker版本:Docker版本17.06.2-ce,构建cec0b72
Docker-compose版本:docker-compose版本1.15.0,build e12f3b9
任何人都知道为什么docker无法找到 mongodb / scripts / init_replicaset.js ?
version: '2' services: blog-app: image: blog environment: - SPRING_PROFILES_ACTIVE=prod,swagger - [....] store-mongodb-node: build: context: ../store/src/main/docker dockerfile: mongodb/MongoDB.Dockerfile command: mongod --replSet rs1 --noprealloc --smallfiles [...]
FROM openjdk:8-jre-alpine ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ JHIPSTER_SLEEP=0 \ JAVA_OPTS="" ADD @project.build.finalName@.war /app.war EXPOSE 8081 CMD echo "The application will start in ${JHIPSTER_SLEEP}s..." && \ sleep ${JHIPSTER_SLEEP} && \ java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /app.war
FROM mongo:3.4.8 ADD mongodb/scripts/init_replicaset.js init_replicaset.js
library(magrittr)
'\"number_123\"somtext 123 some more text\"number_1\" text' %>%
strsplit(" ") %>% # Split character string per space
unlist() %>%
grep("number_", ., value = TRUE) %>% # Extract "words" with number_
gsub("number_", "", .) %>% # Remove "number_" part
gsub('"', "", .) %>% # Remove "number_" part
gsub("[a-z]", "", .) %>% # Remove "number_" part
as.numeric() # Turn into numbers
[1] 123 1
无论如何,谢谢你。
答案 0 :(得分:5)
我找到了解决方案。罪魁祸首是 .dockerignore 文件。您可以在每个应用程序的src/main/docker
文件夹中找到它。
解决方案:从**/*
的内容中删除.dockerignore
**/*
!*.jar
!*.war
Jhipster 4.11.1 仍有此问题。我将提交PR以提醒其官员。