defines a docker container running Arch Linux with the LAMP stack installed
- Install docker
- Download and start the LAMP server instance
docker run --name lamp -p 80:80 -p 443:443 -d greyltc/lamp
- Test the LAMP server
Point your browser to:
and you should see the default apache index. Follow the info.php link there and you should see detials of the php installation.
- [Optional] Change your webserver root data storage location
It's likely desirable for your www root dir to be placed in a persistant storage location outside the docker container, on the host's file system for example. Let's imagine you wish to store your www files in a folder
~/wwwon the host's file system. Then insert the following into the docker startup command (from step 2. above) between
UID 33 or GID 33 (http in the container image) must have at least read permissions for
~/wwwon the host system. Generally, it's enough to do:
chmod -R 770 ~/www; sudo chgrp -R 33 ~/www
Read this if you run into permissions issues in the container.
- [Optional] Use your own ssl certificate
This image comes with a self-generated ssl certificate and so you'll get browser warnings when you access your server via https (but the connection will be encrypted (with a private key that anyone can view by snooping around in the docker image)). You can (& should) replace these self signed certificates with your own, properly generated cert files.
Assuming you have
server.keyfiles in a directory
~/sslCerton the host machine:
sudo chown -R root ~/sslCert; sudo chgrp -R root ~/sslCert
sudo chmod 400 ~/sslCert/server.key
You can then add
-v ~/sslCert:/root/sslKeysto the docker run command line to use your ssl certificate files.
- [Optional] Stop the lamp docker server instance
docker stop lamp
- [Optional] Delete the lamp docker server instance (after stopping it)
docker rm lamp
Try using docker exec to get the containers cli. Once you are are in use mysql -u root
No password is required, but that will get you into the DB interface. Hope this helps.
I too need to access the MySQL DB.
Did anyone figure this out?
Thanks in advance!
How can i access or set the password for mysql database?