Coder Social home page Coder Social logo

docker-lamp's Introduction

Docker-LAMP

Docker-LAMP is a set of docker images that include the phusion baseimage (18.04 and 20.04 varieties), along with a LAMP stack (Apache, MySQL and PHP) all in one handy package.

With Ubuntu 20.04 and 18.04 images on the latest-2004 and latest-1804 tags, Docker-LAMP is flexible enough to use with all of your LAMP projects.

Build Status Docker Hub License

Contents

Introduction

As a developer, part of my day to day role is to build LAMP applications. I searched in vein for an image that had everything I wanted, up-to-date packages, a simple interface, good documentation and active support.

To complicate things even further I needed an image, or actually two, that would run my applications on both 14.04 and 16.04. Having two entirely separate workflows didn't make any sense to me, and Docker-LAMP was born.

Designed to be a single interface that just 'gets out of your way', and works on 18.04 and 20.04 with php 7 and 8. You can move between all images without changing how you work with Docker.

Image Versions

NOTE: PHP 5.6 is end of life, so the PHP 5 images mattrayner/lamp:latest-1404-php5 and mattrayner/lamp:latest-1604-php5 will not receive any updates. Although these images will stay on Docker Hub, we strongly recommend updating you applications to PHP 7 or PHP 8.

NOTE: The 14.04, 16.04 and 18.04 variants of this image are no longer being actively supported or updated.

There are four main 'versions' of the docker image. The table below shows the different tags you can use, along with the PHP, MySQL and Apache versions that come with it.

Component latest-1404 latest-1604 latest-1804-php7 latest-1804-php8 latest-2004-php7 latest-2004-php8
Apache 2.4.7 2.4.18 2.4.29 2.4.41
MySQL 5.5.62 5.7.30 5.7.35 8.0.36
PHP 7.3.3 7.4.6 7.4.23/8.0.10 7.4.33/8.0.30
phpMyAdmin 4.8.5 5.0.2 5.1.1 5.1.1

Using the image

On the command line

This is the quickest way

# Launch a 20.04 based image with PHP 8
docker run -p "80:80" -v ${PWD}/app:/app mattrayner/lamp:latest-2004-php8

# Launch a 20.04 based image with PHP 7
docker run -p "80:80" -v ${PWD}/app:/app mattrayner/lamp:latest-2004-php7

# Launch a 18.04 based image with PHP 8
docker run -p "80:80" -v ${PWD}/app:/app mattrayner/lamp:latest-1804-php8

# Launch a 18.04 based image with PHP 7
docker run -p "80:80" -v ${PWD}/app:/app mattrayner/lamp:latest-1804-php7

# Launch a 16.04 based image with PHP 7
docker run -p "80:80" -v ${PWD}/app:/app mattrayner/lamp:latest-1604

# Launch a 14.04 based image with PHP 5
docker run -p "80:80" -v ${PWD}/app:/app mattrayner/lamp:latest-1404

With a Dockerfile

FROM mattrayner/lamp:latest-2004-php8

# Your custom commands

CMD ["/run.sh"]

MySQL Databases

By default, the image comes with a root MySQL account that has no password. This account is only available locally, i.e. within your application. It is not available from outside your docker image or through phpMyAdmin.

When you first run the image you'll see a message showing your admin user's password. This user can be used locally and externally, either by connecting to your MySQL port (default 3306) and using a tool like MySQL Workbench or Sequel Pro, or through phpMyAdmin.

If you need this login later, you can run docker logs CONTAINER_ID and you should see it at the top of the log.

Creating a database

So your application needs a database - you have three options:

  1. PHPMyAdmin
  2. Command line
  3. Initialization script
PHPMyAdmin

Docker-LAMP comes pre-installed with phpMyAdmin available from http://DOCKER_ADDRESS/phpmyadmin.

NOTE: you cannot use the root user with PHPMyAdmin. We recommend logging in with the admin user mentioned in the introduction to this section.

Command Line

First, get the ID of your running container with docker ps, then run the below command replacing CONTAINER_ID and DATABASE_NAME with your required values:

docker exec CONTAINER_ID  mysql -uroot -e "create database DATABASE_NAME"
Initialization script

See the SQL initialization script section for details.

SQL initialization script

Optionally, you can provide a SQL script which will run immediately after MySQL has been installed and configured, allowing you to run custom SQL e.g. to create a database, users or insert custom data.

Please note that the SQL initialization script runs only at the container first startup. The script won't run if MySQL has already been configured (i.e. if the /var/lib/mysql contains initialized MySQL data).

The below command will run the docker image mattrayner/lamp:latest interactively, exposing port 80 on the host machine with port 80 on the docker container. It will also create a volume linking the script.sql file within your current folder to the /db/init.sql file on the container. This is where the container expects the SQL initialization script to live.

docker run -i -t -p "80:80" -v ${PWD}/script.sql:/db/init.sql:ro mattrayner/lamp:latest

Adding your own content

The 'easiest' way to add your own content to the lamp image is using Docker volumes. This will effectively 'sync' a particular folder on your machine with that on the docker container.

The below examples assume the following project layout and that you are running the commands from the 'project root'.

/ (project root)
/app/ (your PHP files live here)
/mysql/ (docker will create this and store your MySQL data here)

In english, your project should contain a folder called app containing all of your app's code. That's pretty much it.

Adding your app

The below command will run the docker image mattrayner/lamp:latest interactively, exposing port 80 on the host machine with port 80 on the docker container. It will then create a volume linking the app/ directory within your project to the /app directory on the container. This is where Apache is expecting your PHP to live.

docker run -i -t -p "80:80" -v ${PWD}/app:/app mattrayner/lamp:latest

Persisting your MySQL

The below command will run the docker image mattrayner/lamp:latest, creating a mysql/ folder within your project. This folder will be linked to /var/lib/mysql where all of the MySQL files from container lives. You will now be able to stop/start the container and keep your database changes.

You may also add -p 3306:3306 after -p 80:80 to expose the mysql sockets on your host machine. This will allow you to connect an external application such as SequelPro or MySQL Workbench.

docker run -i -t -p "80:80" -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest

Doing both

The below command is our 'recommended' solution. It both adds your own PHP and persists database files. We have created a more advanced alias in our .bash_profile files to enable the short commands ldi and launchdocker. See the next section for an example.

docker run -i -t -p "80:80" -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest

.bash_profile alias examples

The below example can be added to your ~/.bash_profile file to add the alias commands ldi and launchdocker. By default it will launch the 16.04 image - if you need the 14.04 image, simply change the docker run command to use mattrayner/lamp:latest-1404 instead of mattrayner/lamp:latest.

# A helper function to launch docker container using mattrayner/lamp with overrideable parameters
#
# $1 - Apache Port (optional)
# $2 - MySQL Port (optional - no value will cause MySQL not to be mapped)
function launchdockerwithparams {
    APACHE_PORT=80
    MYSQL_PORT_COMMAND=""
    
    if ! [[ -z "$1" ]]; then
        APACHE_PORT=$1
    fi
    
    if ! [[ -z "$2" ]]; then
        MYSQL_PORT_COMMAND="-p \"$2:3306\""
    fi

    docker run -i -t -p "$APACHE_PORT:80" $MYSQL_PORT_COMMAND -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest
}
alias launchdocker='launchdockerwithparams $1 $2'
alias ldi='launchdockerwithparams $1 $2'
Example usage
# Launch docker and map port 80 for apache
ldi

# Launch docker and map port 8080 for apache
ldi 8080

# Launch docker and map port 3000 for apache along with 3306 for MySQL
ldi 3000 3306

Developing the image

Building and running

# Clone the project from Github
git clone https://github.com/mattrayner/docker-lamp.git
cd docker-lamp

# Build the images
docker build --build-arg PHP_VERSION=8.0 -t=mattrayner/lamp:latest -f ./2004/Dockerfile .
docker build --build-arg PHP_VERSION=8.0 -t=mattrayner/lamp:latest-2004-php8 -f ./2004/Dockerfile .
docker build --build-arg PHP_VERSION=7.4 -t=mattrayner/lamp:latest-2004-php7 -f ./2004/Dockerfile .
docker build --build-arg PHP_VERSION=8.0 -t=mattrayner/lamp:latest-1804-php8 -f ./1804/Dockerfile .
docker build --build-arg PHP_VERSION=7.4 -t=mattrayner/lamp:latest-1804-php7 -f ./1804/Dockerfile .

# Run the image as a container
docker run -d -p "3000:80" mattrayner/lamp:latest

# Sleep to allow the container to boot
sleep 30

# Curl out the contents of our new container
curl "http://$(docker-machine ip):3000/"

Testing

We use docker-compose to setup, build and run our testing environment. It allows us to offload a large amount of the testing overhead to Docker, and to ensure that we always test our image in a consistent way that's not affected by the host machine.

One-line testing command

We've developed a single-line test command you can run on your machine within the docker-lamp directory. This will test any changes that may have been made, as well as comparing installed versions of Apache, MySQL, PHP and phpMyAdmin against those expected.

docker-compose -f docker-compose.test.yml -p ci build; docker-compose -f docker-compose.test.yml -p ci up -d; cd tests && ./test.sh; echo "Exited with status code: $?";

So what does this command do?

docker-compose -f docker-compose.test.yml -p ci build;

First, build that latest version of our docker-compose images.

docker-compose -f docker-compose.test.yml -p ci up -d;

Launch our docker containers (web2004-php8 etc.) in daemon mode.

cd tests && ./test.sh;

Change into the test directory and run out tests

echo "Exited with status code: $?"

Report back whether the tests passed or not

Inspiration

This image was originally based on dgraziotin/lamp, with a few changes to make it compatible with the Concrete5 CMS.

I also changed the setup to create ubuntu (well, baseimage, but you get what I'm saying) images so that this project could be as useful as possible to as many people as possible.

Contributing

If you wish to submit a bug fix or feature, you can create a pull request and it will be merged pending a code review.

  1. Clone/fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Test your changes using the steps in Testing
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

Building / Releasing

Manually building and releasing can be done with the following:

docker-compose -f docker-compose.test.yml -p ci build
docker tag ci-web2004-php8 mattrayner/lamp:latest
docker tag ci-web2004-php8 mattrayner/lamp:latest-2004
docker tag ci-web2004-php8 mattrayner/lamp:latest-2004-php8
docker tag ci-web2004-php7 mattrayner/lamp:latest-2004-php7

docker push mattrayner/lamp:latest
docker push mattrayner/lamp:latest-2004
docker push mattrayner/lamp:latest-2004-php8
docker push mattrayner/lamp:latest-2004-php7

License

Docker-LAMP is licensed under the Apache 2.0 License.

docker-lamp's People

Contributors

djackson1 avatar epmatt avatar erichmusick avatar gray0018 avatar jpwesterhof avatar mahmoudajawad avatar mattrayner avatar pzhlkj6612 avatar rmdave avatar undecaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-lamp's Issues

Edit MySql configuration

Trying to edit /etc/mysql/conf.d/mysql.cnf or ``/etc/mysql/my.cnfseems to have no effect in actual server. Even stopping MySql server withservice mysql stop` keeps phpMyAdmin session alive, so I think I'm not working on real mysql server.

What is the correct way to modify mysql config? (I need to disable NO_ZERO_IN_DATE,NO_ZERO_DATE and STRICT mode)

Thank you

Create ARM version

It's possible set up this docker image for ARM architecture ( for example for use this in a rpi3b ) ?
Thanks ,
Andrea

Remove VOLUME "/etc/mysql"

There is a volume point to `/etc/mysql' in each Dockerfile.

VOLUME ["/etc/mysql", "/var/lib/mysql", "/app" ]

VOLUME ["/etc/mysql", "/var/lib/mysql", "/app" ]

The user can mount a folder to volume /etc/mysql. If the configuration files in this folder are correct, it will work well. But if it's an empty folder, or the files are corrupted, then mysqld will not work as expected.

After testing, I found it difficult to rebuild configuration files in /etc/mysql. If a user want to use his own config, he can use docker cp command to achieve this goal. So I don't think there should be the VOLUME "/etc/mysql" in Dockerfiles. In other words, this folder needs to be protected.


If /etc/mysql has not been volumed, some commands in run.sh should be moved to Dockerfiles as persisted configuration. So, the boot script only needs to check some essential configurations but does not include bind-address - it will be modified by the user.


The rebuilding of /var/lib/mysql is easier. Both dpkg-reconfigure and mysqld --initialize (mysqld --initialize-insecure) can do it. The new mysql test script is being written.

Localhost is not opening after stop container

hi guys,

I created a container with the following command (I'm using Windows):

winpty docker run -ti -p 8080:80 --name lamp1 -v //c/projects/lamp_5_6:/app -v //c/projects/lamp_5_6/mysql:/var/lib/mysql mattrayner/lamp:latest-1404-php5

It worked perfectly, however, when I need to stop and start it the localhost doesn't open anymore.

What can I do to it work again?

Thank you.

1804 tagged images don't appear to actually be be 18.04

Your 18.04 images appear to actually be 16.04. I've been attempting to build an application on your latest-1804-php7 image and have been frustrated by some issues that seem to be related to this. See below - release shows 16.04.6 LTS and the sources.list file references xenial deb files.

$> sudo docker run --name test -d mattrayner/lamp:latest-1804
hash.....
$> sudo docker exec test lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.6 LTS
Release:        16.04
Codename:       xenial

g$ sudo docker exec test tail /etc/apt/sources.list
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://security.ubuntu.com/ubuntu/ xenial-security main restricted
deb-src http://security.ubuntu.com/ubuntu/ xenial-security main restricted
deb http://security.ubuntu.com/ubuntu/ xenial-security universe
deb-src http://security.ubuntu.com/ubuntu/ xenial-security universe
deb http://security.ubuntu.com/ubuntu/ xenial-security multiverse
deb-src http://security.ubuntu.com/ubuntu/ xenial-security multiverse

Am I nuts?

Or is the PHP version for 16.04 not 5.6.25 (as indicated in the README) but 7.0 instead?

Lost data

Hi everybody,

I'm starting with the docker. When I launch the container, I create a database and then I stop it.
When I want to run it again, my database is gone.
I can't figure out how to make my data persistent

Thank you in advance

[suggestion] A version of this for Nginx

I really like this version of it, I always use it for my local projects.
I do not know if it would be in your interest to create a version for nginx.

I even tried to create a version used nginx + PHP-FPM + xdebug but I could not, because I did not have so much technical knowledge.

do you suggest me some tutorial for me to make a version of this just for nginx? :-)

Cannot rewrite urls with htaccess

Hi!
I'm running command docker run -i -t -p "8080:80" -p 3307 -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest-1604-php5

Inside app directory I have files doc.php and .htaccess:

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /doc.php [L]

When I open http://localhost:8080, apache shows me standard page with file listing.
Can you please help me with proper config for rewrite urls?

Run composer as non-root user?

I'm new to using Docker. I'd like to use composer in my PHP project. I see it configured in your Dockerfile. I'm trying to run composer init using these commands:

docker ps
docker exec CONTAINERID composer init

I receive a message that says "Do not run Composer as root/super user! See https://getcomposer.org/root for details."

Is there an existing user that can be used to execute composer commands? or perhaps I need to create a local Dockerfile that creates a new user and gives that user permission to composer? Advice would be appreciated.

use navicat connecting to mysql port failed: 2003 - can't connect to mysql server 10061 unknown error

my Dockerfile and docker-compose.yml:

// dockerfile
FROM mattrayner/lamp:latest-1604
CMD ["/run.sh"]

// docker-compose.yml
version: "3"

services:
  lamp:
    build: 
      context: .
      dockerfile: Dockerfile
    volumes:
      - "/home/chwech/tp5:/app"
      - "/home/chwech/mysql-data:/var/lib/mysql"
    ports:
      - "3306:3306"
      - "8081:80"

my container status:

image

navicat and docker is in different machine. i can use admin user and phpmyadmin cannect to mysql, but navicat can't. how can i connect to mysql? thank you!

Mac OS work slow /app

Hi, I'm new to the docker. I had a problem. The mounted folder /app is very slow. What could be the problem ?

Connecting to MySQL remotely

I am struggling to enable remote connection to the mysql server.

  1. MySQL running fine and I can access using the admin user via phpMyAdmin
  2. The rights for admin seem to allow all hosts (%)
  3. When trying to connect from another PC via MySQL IDE I always get 10061:Unknown error

I created the docker container with a port mapping "xxxx:3306" - so I am using the external port in my connection setup.

Do I need to do anything else to allow external connection?

Second execution just hangs there

Hi,

when I first run docker run -p "80:80" -v ${PWD}/app:/app mattrayner/lamp:latest-1604 on a clean Docker, it works as expected. Containers starts, all good.
Then as I stop the running container with docker stop or docker kill, then try to run the first command again, it just hangs there and nothing happens.
Meanwhile I can see in docker ps, that there is a running container, but none of the services are available.

Trying to restore databases based on mysqldumps fails

Hi

I am simply trying to do a:
mysql -uroot -p<pass> <dbname> < <some_dump>.sql
Because we're "faking" a whole production environment inside of this docker
container. Unfortunately, it fails because the mysql service isn't up and running when we execute the scripts. I have both tried to execute it in a
bash script after i do the docker run on the container, exactly the same way that you use mysql in the documentation. And i get the same error if i e.g. copy all of the *.sql files with COPY or ADD, and then with CMD try to execute them. So it is like that the way sql works with this image is that the service isn't up and running. Have you tried to restore any database via mysql your self? or are you able to provide a recipe? been stuck on this issue for 5 hours or so :(

Trying to enable userdir module

I'm trying to enable the userdir apache module for the container to serve content from the host's /home

So my dockerfile looks like:

....
RUN a2enmod userdir
....
VOLUME  ["/etc/mysql", "/var/lib/mysql", "/app", "/home" ]

When i run the container, /home gets mounted correctly from the host, but I get 404 when trying to access .../~username/index.html

EDIT:
So I did a bit more testing:

  1. When I try without a /home volume, and I create users inside the container, userdir mod works without issue
  2. When I try with an empty host directory as /home volume, and I create users inside the container, userdir mod works without issue
  3. When I try to use host's /home as the container's /home, although it gets mounted correctly, apache returns 404.

What I want is No. 3.

I don't know how to proceed from here to make this work. My only idea is to implement the same behavior using rewrite instead of userdir.

Add a test for phpMyAdmin

We want to ensure that changes to the image won't prevent phpMyAdmin from working. I'll look into an automated script that logs onto the admin pages

PHP 7?

Will there be a PHP 7 release of DockerLAMP?

Persistance

Hi,
I'm new to docker and first I would like to thank you for your job. After testing a lot of images I luckily found yours which works and is documented!

I'm running Docker Toolbox on Windows 10. This is the command I've used to run the container.
docker run -d -p 32787:80 --name xxx -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql mattrayner/lamp:latest-1604-php7
As you can see I've followed your instructions to persist app and mysql data. But afer a restart of docker all changes are lost.
Do you have any idea why?

Best regards, Tom

mysql remote connection issue

I am trying to expose 3306 to my Docker host via: -p "3306:3306". I cannot connect to 3306 from outside the container.
Someone on the Docker Slack community helped, and it looks like MySQL is bound to 127.0.0.1:3306 inside the container, not 0.0.0.0:3306.
Can you take a look?

root@117903e45f7f:/# apt install net-tools && netstat -lnp | grep 3306
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
net-tools
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 175 kB of archives.
After this operation, 725 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 net-tools amd64 1.60-26ubuntu1 [175 kB]
Fetched 175 kB in 0s (202 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package net-tools.
(Reading database ... 17375 files and directories currently installed.)
Preparing to unpack .../net-tools_1.60-26ubuntu1_amd64.deb ...
Unpacking net-tools (1.60-26ubuntu1) ...
Setting up net-tools (1.60-26ubuntu1) ...
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -

Provide environment var export

The password changes in every docker start, could be useful export the generated password to use as an environment variable in PHP.

No such file or directory

With docker for windows I try to run any of the versions with:

docker run -p 80:80 -p 3306:3306 -v D:\dev\docker\www:/app -v D:\dev\docker\mysql:/var/lib/mysql mattrayner/lamp:latest

and any version get stuck on:
sed: can't read /etc/php/7.2/apache2/php.ini: No such file or directory

And take forever to start the container. After almost five minutes continues and starts the container.

Security fixes needed

According to quay.io there are a number of security issues with the 0.1.0 release of the image.

We need to add apt-get upgrade as part of our build process. This will allow us to launch with the most up-to-date libraries and fix a number of vulnerabilities

Fail to build image from Dockerfile

Branch : Master
Commit: daef707
Docker version : 18.06.1

cd docker-lamp/  
docker build -t=mattrayner/lamp:latest-1404 -f ./1404/Dockerfile .  

Error

 Step 13/42 : RUN echo exit 0 > /usr/sbin/policy-rc.d &&   LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php &&   apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C &&   apt-get update &&   apt-get -y upgrade &&   apt-get install -y apache2-mpm-prefork &&   a2dismod mpm_prefork &&   a2dismod mpm_event &&   apt-get -y install supervisor wget git apache2 php-xdebug libapache2-mod-php mysql-server php-mysql pwgen php-apcu php7.1-mcrypt php-gd php-xml php-mbstring php-gettext zip unzip php-zip curl php-curl &&   apt-get -y autoremove &&   echo "ServerName localhost" >> /etc/apache2/apache2.conf
 ---> Running in 712a5ea47bed
Cannot add PPA: 'ppa:ondrej/php'.
Please check that the PPA name or format is correct.
The command '/bin/sh -c echo exit 0 > /usr/sbin/policy-rc.d &&   LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php &&   apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C &&   apt-get update &&   apt-get -y upgrade &&   apt-get install -y apache2-mpm-prefork &&   a2dismod mpm_prefork &&   a2dismod mpm_event &&   apt-get -y install supervisor wget git apache2 php-xdebug libapache2-mod-php mysql-server php-mysql pwgen php-apcu php7.1-mcrypt php-gd php-xml php-mbstring php-gettext zip unzip php-zip curl php-curl &&   apt-get -y autoremove &&   echo "ServerName localhost" >> /etc/apache2/apache2.conf' returned a non-zero code: 1

Update image to use Ubuntu 16.04

At the moment the image uses 14.04 - it would be good to have an 'updated' version of the plugin which supports 16.04 and is api compatible.

MySQL fails to start when mounting local folder on Windows + VirtualBox

I'm using Docker Toolbox for Windows, version Docker version 18.03.0-ce, build 0520e24302. (I'm using this rather than the newer Docker for Windows so I can continue to use VirtualBox.)

When I try to map a local folder for MySQL, it seems MySQL can't start. I see repeated output:

=> Waiting for confirmation of MySQL service startup

In VirtualBox, my whole 'c' drive is shared and configured for "full" access. Other directories map properly (e.g. for Apache), though that is only doing read operations.

Output when trying to run mysqld:

root@cd3f5b3cb152:/var/log/mysql# mysqld
180520 1:32:17 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
180520 1:32:17 [Note] mysqld (mysqld 5.5.58-0ubuntu0.14.04.1) starting as process 577 ...
180520 1:32:17 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
180520 1:32:17 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
180520 1:32:17 [Note] Plugin 'FEDERATED' is disabled.
180520 1:32:17 InnoDB: The InnoDB memory heap is disabled
180520 1:32:17 InnoDB: Mutexes and rw_locks use GCC atomic builtins
180520 1:32:17 InnoDB: Compressed tables use zlib 1.2.8
180520 1:32:17 InnoDB: Using Linux native AIO
180520 1:32:17 InnoDB: Initializing buffer pool, size = 128.0M
180520 1:32:17 InnoDB: Completed initialization of buffer pool
InnoDB: Error: space header page consists of zero bytes in data file ./ibdata1
180520 1:32:17 InnoDB: Could not open or create data files.
180520 1:32:17 InnoDB: If you tried to add new data files, and it failed here,
180520 1:32:17 InnoDB: you should now edit innodb_data_file_path in my.cnf back
180520 1:32:17 InnoDB: to what it was, and remove the new ibdata files InnoDB created
180520 1:32:17 InnoDB: in this failed attempt. InnoDB only wrote those files full of
180520 1:32:17 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
180520 1:32:17 InnoDB: remove old data files which contain your precious data!
180520 1:32:17 [ERROR] Plugin 'InnoDB' init function returned error.
180520 1:32:17 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
180520 1:32:17 [ERROR] Unknown/unsupported storage engine: InnoDB
180520 1:32:17 [ERROR] Aborting

180520 1:32:17 [Note] mysqld: Shutdown complete

I'm new to Docker, and I'm not a super expert at MySQL ... so I'd appreciate any guidance for how to troubleshoot further. I can see that a bunch of files were created in the mysql folder I mounted.

VirtualBox version: 5.2.8 r121009

Release

Hey Matt,

If it's not too much trouble, would you mind pushing a release? The work I did in #22 would help me out right about now :)

Thanks in advance!

php.ini

Is there any way to edit php.ini. I have tried docker exec -it CONTAINER_ID, then edited .../php/7.3/php.ini but nothing happend =(

Dockerfile webapp

Hello, I am creating a webapp with docker and I have several doubts. (https://github.com/alebupal/tvspy/tree/desarrollo)
For my app to work properly I need to create a database and run a .sh
My dockerfile file is the following:
https://github.com/alebupal/tvspy/blob/desarrollo/Dockerfile
and the .sh to execute is the following:
https://github.com/alebupal/tvspy/blob/desarrollo/include/comandos.sh

The problem is that once the run.sh my script is run to create the db and the cron is not executed.

In short, I want that when the container starts (PHP, MYSQL) a database is created and execute a .sh so that my application works.
Greetings and thanks for the docker!

I'm finally copying the run.sh

Enhancement: phpMyAdmin configuration storage is not configured

mysql -uroot -e " GRANT ALL PRIVILEGES ON phpmyadmin.* TO 'pma'@'localhost' IDENTIFIED BY ''"

The above command will cause an error.

ERROR 1133 (42000) at line 1: Can't find any matching row in the user table

Show all databases.

+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+

I think the reason is that all configurations related to phpMyAdmin configuration storage are commented out in /var/www/phpMyAdmin-4.9.0.1-all-languages/config.inc.php.

/**
 * MyAdmin configuration storage settings.
 */

/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';
// $cfg['Servers'][$i]['controlport'] = '';
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';

/* Storage database and tables */
// $cfg['Servers'][$i]['pmadb'] = 'myadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma__relation';
// $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
// $cfg['Servers'][$i]['history'] = 'pma__history';
// $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
// $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
// $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
// $cfg['Servers'][$i]['recent'] = 'pma__recent';
// $cfg['Servers'][$i]['favorite'] = 'pma__favorite';
// $cfg['Servers'][$i]['users'] = 'pma__users';
// $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
// $cfg['Servers'][$i]['users'] = 'pma__users';
// $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
// $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
// $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
// $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
// $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
// $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';

So we either write config.inc.php in advance and do replacement in the script (to enable this function), or simply comment that command out.

Dockerfile Connect to database and create table

Hi,

I'd like to Create a database and a table when launching this image from a dockerfile. The problem I face is that I don't really know how can I get a mysql password from docker. Is it possible to do that?

No support for custom virtualhost configs

In many cases, a LAMP setup will already have an Apache config file that defines service-specific settings. As I can see, this image forces the usage of a premade config file, with no option to replace it using the Docker workflows.

Would be ideal to add the ability to define alternative virtualhost configurations.

Virtual Hosts

Hi, how can I add virtual hosts to apache in this image?
thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.