ubuntu-lamp-docker/README.md

75 lines
1.9 KiB
Markdown
Raw Normal View History

2016-09-23 07:42:53 +03:00
# Ubuntu 16.04 (aka xenial) LAMP Docker container
This project bulds a simple Ubuntu 16.04 LAMP docker container. It is based on the official Ubuntu 16.04 (xenial) Docker image.
What's included:
* Ubuntu 16.04.1 LTS
* Apache 2.4.18
* MariaDB Server 10.0.27
* PHP 7.0.8
### Build instructions
* Download the *ubuntu-lamp-docker* repository:
2018-06-07 00:50:20 +03:00
```
git clone https://git.theo-andreou.org/Personal/ubuntu-lamp-docker.git
```
2016-09-23 07:42:53 +03:00
* Build the image:
2018-06-07 00:50:20 +03:00
```
2016-09-23 07:42:53 +03:00
cd ubuntu-lamp-docker
docker build -t "username/ubuntu-lamp" .
2018-06-07 00:50:20 +03:00
```
2016-09-23 07:42:53 +03:00
Verify that the image has been created in the local image store:
2018-06-07 00:50:20 +03:00
```
2016-09-23 07:42:53 +03:00
docker images | grep ubuntu-lamp
theodotos/ubuntu-lamp latest f54ab36adc4f About a minute ago 508.8 M
2018-06-07 00:50:20 +03:00
```
2016-09-23 07:42:53 +03:00
### Use it directly from Docker Hub
If you do not want to build it yourself you can pull it from https://hub.docker.com:
```
docker pull theodotos/ubuntu-lamp
```
### Run the container
* Prepare the necessary volumes for persistency:
2018-06-07 00:50:20 +03:00
```
2016-09-23 07:42:53 +03:00
docker volume create --name lamp-mariadb
docker volume create --name lamp-docroot
docker volume create --name lamp-apache-conf
docker volume create --name lamp-mariadb-conf
2018-06-07 00:50:20 +03:00
```
2016-09-23 07:42:53 +03:00
* Run the container:
2018-06-07 00:50:20 +03:00
```
2016-09-23 08:43:54 +03:00
docker run -d -p 2080:80 -p 2443:443 --name lamp -v lamp-mariadb:/var/lib/mysql -v lamp-docroot:/var/www/html -v lamp-apache-conf:/etc/apache2 -v lamp-mariadb-conf:/etc/mysql theodotos/ubuntu-lamp
2018-06-07 00:50:20 +03:00
```
2016-09-23 07:42:53 +03:00
* Verify that its up and running:
2018-06-07 00:50:20 +03:00
```
2016-09-23 07:42:53 +03:00
docker ps | grep lamp
c5b0f3d48307 theodotos/ubuntu-lamp "/bin/sh -c /entrypoi" About a minute ago Up About a minute 3306/tcp, 0.0.0.0:2080->80/tcp, 0.0.0.0:2443->443/tcp lamp
2018-06-07 00:50:20 +03:00
```
2016-09-23 07:42:53 +03:00
* Check the logs:
2018-06-07 00:50:20 +03:00
```
2016-09-23 07:42:53 +03:00
docker logs lamp
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
160923 04:35:57 mysqld_safe Logging to syslog.
160923 04:35:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2018-06-07 00:50:20 +03:00
```