Public Repository

Last pushed: 6 months ago
Short Description
Short description is empty for this repo.
Full Description

Puling the MySQL image

docker pull mysql

Running the MySQL container

docker run --name wp-mysql -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=wpdb -e MYSQL_USER=wpuser -e MYSQL_PASSWORD=wppassword -p 3306:3306 mysql


    --name wp-mysql – adds a name for our container. We will be able to use it instead of container ID.
    -e – sets environment variables that the mysql iname uses.
        MYSQL_ROOT_PASSWORD – password of root user,
        MYSQL_DATABASE – name of the database that will be created when container starts,
        MYSQL_USER – name of the user that will have all privilages (superuser) in MYSQL_DATABASE,
        MYSQL_PASSWORD – password for MYSQL_USER.
    -p 3306:3306 - 3306 is a port where mySQL will be available. We publish it outside to have an access to database.

Setting the database

You can use any appliation available to connect with database.
For instance:

Use this settings to connect with the database

  • Hostname:
  • Port 3306
  • Username: wpuser
  • Password: wppassword
  • Default Schema: wpdb

You should import the database dump next

Once the container is ready you can start and run it later, without the need of importing the database again.

docker stop wp-mysql
docker start wp-mysql

Pulling Ubuntu + Apache2 + php 7

docker pull mpolinski/apache-suntsu
docker run -i -t -p 80:80 -p 443:443 --name wp-apache --rm --link wp-mysql:mysql -v {path/to/local/website/repo}:/var/www/html mpolinski/apache-suntsu /bin/bash

You will have an access to container's console after running this image. Apache2 service needs to be started manually.

$ service apache2 start


    -i - interactive mode,
    -t - pseudo TTY,
    --rm – container will be automatically removed after stopping,
    --link - link with another working container. You will be able to use that name instead of container IP address.
    -v mounts a directory passed as a first part of the param into the container (second part of the param)

Testing the site.

Remember that wp-config.php is not in suntsu repository. You will have to add the file to your local suntsu git repo. Add those lines in wp-config.php file to force the site URL.


wp-config.php should also be set up to use adtabase from container.

define('DB_NAME', 'wpdb');
define('DB_USER', 'wpuser');
define('DB_PASSWORD', 'wppassword');
define('DB_HOST', 'mysql');

Site will be available under https://localhost.

Docker Pull Command