Make a web site to be portable, using Apache/PHP/MySQL.
- Put your web site into the
www
directory
(index.php
is given as sample). - Change variables in
mysql.sh
: DB_NAME, DB_USER, USER_PASSWD...
This script will be deleted and not included into the image. - Replace the
database.sql
with the dump of your database.
It will be processed once, while compiling the Docker image, then deleted.
Replace IMAGENAME with the lower case name you want :
$ cd [path to the Dockerfile]
$ docker build -t [IMAGENAME] .
$ docker run -d -p 80:80 [IMAGENAME]
Then open your browser to http://localhost.
Look at your container id with :
docker ps
then
docker exec -it [CONTAINER ID] bash
root@d779731e73ac:/# mysql -u myuser -p
The user, or root, are those you can manage in the mysql.sh
file before the build.
docker exec -it [CONTAINER ID] bash
root@d779731e73ac:/# tail -f /var/log/apache2/error.log
root@d779731e73ac:/# tail -f /var/log/apache2/access.log