Skip to content

Instantly share code, notes, and snippets.

@escopecz
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save escopecz/ab30dae4b9b4ff428d28 to your computer and use it in GitHub Desktop.
Save escopecz/ab30dae4b9b4ff428d28 to your computer and use it in GitHub Desktop.
Pagekit with Docker

How to run Pagekit with Docker

Pull Pagekit + server

sudo docker pull marksteve/pagekit

Clone MySql git repo

Firstly, go to a directory where scripts from gir repo should be stored.

git clone https://github.com/tutumcloud/tutum-docker-mysql.git

Create MySql image

docker build -t tutum/mysql .

Create mysql container

sudo docker run -d -p 3307:3306 -e MYSQL_PASS=admin -v /var/www/html/docker/mysql/data:/var/lib/mysql --name mysql tutum/mysql

Notes:

  • Local port 3307 is mounted to container port 3306. I use port 3307 because port 3306 is used with my local mysql server.
  • Mysql container will use local folder /var/www/html/docker/mysql/data as data volume to store database data so data will not be erased together with stopping the container.

Log into the container to query database

It is possible to log into mysql container to execute some SQL queries. In our case we need to create a database for Pagekit.

mysql -uadmin -padmin -P3307 -h 0.0.0.0

Create a database

create database pagekit;

To return back: exit;

Create a pagekit container and link it with mysql container

sudo docker run -d -p 8000:80 --link mysql:mysql --name pagekit marksteve/pagekit

Database access

  • host: mysql (alias of the mysql container has correct ip address at hosts file)
  • user: admin
  • pass: admin
  • database: pagekit

Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment