我在Dockerfile中指定了以下docker命令(1)来运行war文件,但是正在执行的命令是/ bin / bash。然后,docker-compose.yml使用docker文件运行mysql和jar文件。如何使命令从Dockerfile中的入口点获取?我将非常感谢任何形式的帮助和知识共享。
我的Dockerfile:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.co.uk [NC]
RewriteRule ^(.*)$ https://example.co.uk/$1 [L,R=301]
</IfModule>
# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/news-blog-speaker/?$ [NC]
RewriteRule ^/blog/?$ /news/$1 [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
我的docker-compose.yml文件
FROM openjdk:11
EXPOSE 8080
ADD target/dashboard---back-end.war dashboard---back-end
ENTRYPOINT ["java", "-jar", "dashboard---back-end.war"] <-- (1)
运行version: '3'
services:
mysql-standalone: #container name for the mysql
image: 'mysql:5.7' #mysql docker image
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_PASSWORD=root
- MYSQL_DATABASE=dashboard2
ports:
- "3307:3306"
dashboard---back-end:
image: dashboard---back-end
ports:
- "8080:8080"
stdin_open: true
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql-standalone:3306/dashboard2?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
SPRING_DATASOURCE_USERNAME: "root"
SPRING_DATASOURCE_PASSWORD: "root"
build:
context: "./"
dockerfile: "Dockerfile"
depends_on:
- mysql-standalone
,将显示命令当前和预期之间的差异
运行mysql之后,命令提示符仅在此处停止,下面显示了当前内容以及运行docker ps -a
命令时应期待的内容。