Sign inSign up

vect0r/lamp

By vect0r

Updated about 9 years ago

A bare bones LAMP image (UBUNTU + APACHE + PHP + MYSQL)

Image
0

1.2K

vect0r/lamp repository overview

A pre-configured LAMP container

A bare build LAMP image (APACHE 2.4+ PHP 5.5 + MYSQL 5.5)

Usage

To create the image vect0r/lamp, execute the following command:

docker build -t vect0r/lamp .

Running image

Start your image binding below ports:

docker run -d -p 80:80 -p 3306:3306 vect0r/lamp

Test your deployment through a browser on your host or through curl:

curl http://localhost/

Hello world!

Inspect running container

If you would like to connect to your container and have a poke around, just do;

docker exec -it <containerID> bash

Connecting to the bundled MySQL server from within the container

The bundled MySQL server has a root user with no password for local connections. Simply connect from your PHP code with this user:

<?php
$mysql = new mysqli("localhost", "root");
echo "MySQL Server info: ".$mysql->host_info;
?>

Connecting to the bundled MySQL server from outside the container

The first time that you run your container, a new user admin with all privileges will be created in MySQL with a random password. To get the password, check the logs of the container by running:

docker logs $CONTAINER_ID

You will see an output like the following:

======================================================================== You can now connect to this MySQL Server using:

mysql -uadmin -p47nnf4FweaKu -h<host> -P<port>

Please remember to change the above password as soon as possible! MySQL user 'root' has no password but only allows local connections

In this case, 47nnf4FweaKu is the password allocated to the admin user.

You can then connect to MySQL:

mysql -uadmin -p47nnf4FweaKu

Remember that the root user does not allow connections from outside the container - you should use this admin user instead!

Setting a specific password for the MySQL server admin account

If you want to use a preset password instead of a random generated one, you can set the environment variable MYSQL_PASS to your specific password when running the container:

docker run -d -p 80:80 -p 3306:3306 -e MYSQL_PASS="mypass" vect0r/lamp

You can now test your new admin password:

mysql -uadmin -p"mypass"

Tag summary

Content type

Image

Digest

sha256:cb05bed71

Size

142.3 MB

Last updated

almost 11 years ago

docker pull vect0r/lamp