Coder Social home page Coder Social logo

docker-lamp's Issues

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!

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!

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

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

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.

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.

PHP 7?

Will there be a PHP 7 release of DockerLAMP?

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.

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?

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 -

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

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

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?

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.

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.

Create ARM version

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

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

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 ?

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

Virtual Hosts

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

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

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

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.

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.

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 :(

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.

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 =(

[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?

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.

Am I nuts?

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

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.

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

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.