/docker4drupal8onvagrant

Docker container for drupal 8 on vagrant

Directions for running on Vagrant

  1. Create a CentOS 7 vagrant box and install docker on it

     yum install docker
    
  2. Install Git

     yum install git
    
  3. Clone the repo into /opt

     cd /opt && git clone https://github.com/BlackMesh/docker4drupal8onvagrant.git 
    
  4. Run the Dockerfile

     cd docker4drupal8onvagrant & docker build -t vagrant/drupal .
    
  5. Run supervisord

     docker run -d -v  /var/www/<drupal 8 root directory>:/var/www/html -p 80:80 -p 127.0.0.1:3306:3306 -t -i vagrant/drupal
    
  6. In your Vagrantfile, make sure you open up port 80 and 3306

     config.vm.network "forwarded_port", guest: 80, host: 10080
     config.vm.network "forwarded_port", guest: 3306, host: 13306
    
  7. Open a browser and you should see the screens for setting up drupal

     127.0.0.1:10080
    

Notes

  • No database users or passwords have been created. The root password is "root" and can be accessed on port 3306 from your vm
  • When you shut down the container, all of your mysql data will be lost. To learn how to modify the Dockerfile to enable local filesystem access, check out this link: Docker VOLUME. When you do this, you will also need to modify the mysql configuration at /etc/my.cnf.

Handy Scripts

Should you run into issues setting up your container and image, use these scripts to automatically remove them so you can test your Dockerfile

  • Remove all containers

      docker rm $(docker ps -a -q)
    
  • Remove all images

      docker rmi $(docker images | grep "^<none>" | awk "{print $3}")