我将此original项目转换为docker-compose项目here,然后按照设置instructions进行设置。似乎我无法连接浏览器。
SQL file包含数据库架构,如下所示:
CREATE DATABASE mgsv;
CREATE USER 'mgsv_user'@'localhost' IDENTIFIED BY 'mgsvpass';
GRANT SELECT, INSERT, CREATE, DROP ON mgsv.* TO 'mgsvuser'@'localhost';
use mgsv;
CREATE TABLE IF NOT EXISTS `userinfo` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`email` text NOT NULL,
`hash` text NOT NULL,
`synfilename` text NOT NULL,
`annfilename` text NOT NULL,
`url` text NOT NULL,
`session_id` text NOT NULL,
`annImage` int(5) NOT NULL,
`create_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
docker-compose.yml看起来像这样:
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
- MYSQL_DATABASE=mgsv
- MYSQL_USER=mgsv_user
- MYSQL_PASSWORD=mgsvpass
- MYSQL_ROOT_PASSWORD=mysql123
volumes:
- ./mysql:/docker-entrypoint-initdb.d
www:
build: ./mGSV
restart: always
ports:
- 8080:8080
Dockerfile包含PHP和所有其他工具设置,看起来像这样。
FROM php:5-apache
RUN apt-get update && apt-get install -y --no-install-recommends \
openjdk-7-jdk \
maven \
git \
&& rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/qunfengdong/mGSV.git
# Move the folder 'mgsv' to DocumentRoot of Apache web server. By default, the DocumentRoot of Apache is /var/www/ (speak to the system administrator to know the exact DocumentRoot).
RUN cd /var/www/html/mGSV \
&& mkdir tmp \
&& chmod -R 777 tmp
RUN cd /var/www/html/mGSV && sed -i.bak "s|'gsv'|'mgsv_user'|" lib/settings.php \
&& sed -i.bak "s|$database_pass = ''|$database_pass = 'mgsvpass'|" lib/settings.php \
&& sed -i.bak "s|cas-qshare.cas.unt.edu|localhost|" lib/settings.php
RUN cp /var/www/html/mGSV/Arial.ttf /usr/share/fonts/truetype/
#Do not understand
#7. Cleanup scripts are provided to drop database synteny and annotation tables, remove entries from database table 'userinfo' and delete the folder containing image files which are older than 60 days. This task is accomplished by cron job to run the cleanup script every day. To create a cron job, use the command below:
# shell> crontab -e
#At the last line of crontab, copy and paste the line below, and provide the exact path to mgsv/lib/cleanup.php
# 30 04 * * * /var/www/mgsv/lib/cleanup.php
#The script cleanup.php will be executed at 4:30 AM every morning.
#8. mGSV uses the mail function from PHP to send email to users. Speak to your system administrator to provide required information in the PHP configuration file called 'php.ini'.
#9. When installation completes, you can now open Install/index.php (i.e., http://<YOUR_SERVER_DOMAIN_NAME>/mgsv/Install/), which verifies prerequisites, database setup, and installation. YOUR_SERVER_DOMAIN_NAME refers to the domain name of your server.
RUN cd /var/www/html/mGSV/ws \
&& tar -xzf mgsv-ws-server.tar.gz
RUN cd /var/www/html/mGSV/ws/mgsv-ws-server \
&& mvn package
RUN cp -f /var/www/html/mGSV/ws/mgsv-ws-server/target/ws-server-1.0RC1-jar-with-dependencies.jar /var/www/html/mGSV/ws/
RUN cd /var/www/html/mGSV/ws \
&& echo "mgsv_upload_url=http://localhost/mgsv" > config.properties \
&& echo "ws_publish_url=http\://localhost\:8081/MGSVService" >> config.properties \
&& java -jar ws-server-1.0RC1-jar-with-dependencies.jar &
#To stop the web service
#shell> ps aux | grep ws-server-1.0RC1-jar-with-dependencies.jar
#*Note the process id from the output*
#shell> kill -9 <process id>
这是我得到的输出:
Successfully tagged mgsvdocker_www:latest
Starting mgsvdocker_www_1 ...
mgsvdocker_db_1 is up-to-date
Starting mgsvdocker_www_1 ... error
ERROR: for mgsvdocker_www_1 Cannot start service www: driver failed programming external connectivity on endpoint mgsvdocker_www_1 (37d78703b379b65521d9fc15d2d1d51379f7eee71f7dc912585e088d8bf1b4e9): Bind for 0.0.0.0:8080 failed: port is already allocated
ERROR: for www Cannot start service www: driver failed programming external connectivity on endpoint mgsvdocker_www_1 (37d78703b379b65521d9fc15d2d1d51379f7eee71f7dc912585e088d8bf1b4e9): Bind for 0.0.0.0:8080 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.
我不确定docker-compose.yml内的Dockerfile文件或数据库配置是否出错。
任何机会,有谁知道我错过了什么?
提前谢谢