Cobra Forum

Other Discussion and Support => Tutorials => Topic started by: mahesh on Dec 11, 2023, 07:02 AM

Title: Five minute Wordpress in a Docker container.
Post by: mahesh on Dec 11, 2023, 07:02 AM
Environment
Ubuntu mini.iso in a Virtualbox v4.3.18 host w\20G hd.
No tasksel packages other than ssh during install.

Prerequisites
Docker requires a 64-bit installation regardless of your Ubuntu version.
Additionally, your kernel must be 3.10 at minimum.
The latest 3.10 minor version or a newer maintained version are also acceptable.

Installation
Code:
curl -sSL https://get.docker.com/ | sh && docker version
should give you this output:
Code:
    Client:
     Version:      1.8.2
     API version:  1.20
     Go version:   go1.4.2
     Git commit:   0a8c2e3
     Built:        Thu Sep 10 19:19:00 UTC 2015
     OS/Arch:      linux/amd64
   
    Server:
     Version:      1.8.2
     API version:  1.20
     Go version:   go1.4.2
     Git commit:   0a8c2e3
     Built:        Thu Sep 10 19:19:00 UTC 2015
     OS/Arch:      linux/amd64

Enable UFW forwarding
Code:
vi /etc/default/ufw
and set
DEFAULT_FORWARD_POLICY="ACCEPT"

Enable UFW Firewall
Code:
sudo ufw enable && ufw reload
Allow incoming connections
Code:
ufw allow 2375/tcp
ufw allow from 192.168.1.3 to any port 22
# 192.168.1.3 is my desktop host. If you don't need to ssh in, then omit this. Seems unlikely however.

Configure a DNS server for use by Docker
Code:
sudo vi /etc/default/docker
and use
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"

Code:
restart docker
Pull and run a mysql container
Code:
docker run --restart=always --name mysql -P -e MYSQL_ROOT_PASSWORD=<secret_mysql_rootpassword> -d mysql:5.7Pull and run the latest wordpress container
Code:
docker run --restart=always --name wordpress --link mysql -p 8080:80 -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_PASSWORD=<secret_mysql_rootpassword> -d wordpressCheck Wordpress application
http://<ip_of_virtualbox_host>:8080

The "--restart=always" options allow for persistence across reboots of the VM.

All done as root user during this install.

Enjoy the Goodness.