lamp_docker_container_with_adminer

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
lamp_docker_container_with_adminer [05.11.2020 05:11] – created Pascal Suterlamp_docker_container_with_adminer [05.11.2020 05:22] (current) – [The files needed] Pascal Suter
Line 5: Line 5:
  
 so here i am, creating a docker image that includes the following:  so here i am, creating a docker image that includes the following: 
-  * based on latest ubuntu (that's right, not even LTS, who cares for a trow-away)+  * based on latest ubuntu
   * apache2   * apache2
   * mariadb-server    * mariadb-server 
Line 31: Line 31:
 </code> </code>
 here are the contents of those files:  here are the contents of those files: 
-==== Dockerfile ==== 
 <code bash Dockerfile> <code bash Dockerfile>
 FROM ubuntu:latest FROM ubuntu:latest
Line 104: Line 103:
 <?php phpinfo(); ?> <?php phpinfo(); ?>
 </code> </code>
 +
 +===== Usage =====
 +now simply build the container using the ''./build.sh'' script and then run it using the ''./run.sh'' script. once the container is started you are in a root-shell within the container. to detach from it press ''CTRL''+''p'' followed by ''CTRL'' + ''q''. to attach to it again later use ''docker attach uamp'' 
 +
 +you can access the webserver via ''http://localhost:8080'' on your machine and you can ssh to ''ssh -p 2222 jdoe@localhost'' and login using the password ''jdpasswd''
 +
 +the user ''jdoe'' has full sudo privileges, so to do stuff as root simply use ''sudo'' as you would in a normal ubuntu installation
 +
 +===== customizations =====
 +to set another default password upon the first start of the container, you can edit the line in ''run.sh'' where the ''DEFAULTPW'' environment variable is passed to the container. this is done so you can for example use a tool like ''pwgen'' to autmoatically generate a random password and then echo that upon starting the container if you prefer to have a new random password generated each time you spool up a new container. 
 +
 +you can also start the container in detached mode (aka in the background) right away, edit the ''run.sh'' to do so.. there is already an example for that in there. 
 +
 +as stated above, you can login to the container and then use apt to add additional tools and such. if you add a system service (like for example postgreSQL) you can't start it using ''systemctl'' as systemd is not working inside a container. Use ''service xyz start'' instead. if you want the service to be started each time you restart your container, add it to ''/usr/local/bin/startup.sh'' 
  • lamp_docker_container_with_adminer.1604549483.txt.gz
  • Last modified: 05.11.2020 05:11
  • by Pascal Suter