尝试在单个Alpine映像中同时运行java和http服务。 httpd服务在某些方面失败。
Dockerfile
FROM java:8-jdk-alpine
RUN apk add --no-cache apache2-proxy apache2-ssl apache2-utils
WORKDIR /var/www/
COPY html/ .
WORKDIR /var/backed
COPY backed-0.0.1-SNAPSHOT.jar .
EXPOSE 80/tcp
EXPOSE 8085/tcp
CMD [“sh”,"-c","/usr/sbin/httpd -D FOREGROUND && java -jar /var/backed/backed-0.0.1-SNAPSHOT.jar"]
Docker运行命令:
$ sudo docker run -p 8080:80 -p 8085:8085 server:1.0
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
██╗ ██╗ ██╗ ████████╗ ███████╗ ██████╗ ████████╗ ████████╗ ███████╗
██║ ██║ ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
██║ ████████║ ██║ ███████╔╝ ╚█████╗ ██║ ██████╗ ███████╔╝
██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║
╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗
╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝
:: JHipster ? :: Running Spring Boot 2.1.8.RELEASE ::
:: https://www.jhipster.tech ::
张贴了上面运行的容器的摘要,我认为httpd服务会立即退出。
我能够在172.17.0.2:8085上查看jhipster主页,但是前端172.17.0.2:8080或172.17.0.2会“连接超时”。
如何使前端工作?