Docksal'd Docker and Drupal 8

Local Drupal 8 Development using Docker containers with Docksal

NOTE: This is currently under construction as I learn Docker/Docksal! It's incomplete/ever-changing.

Requirements

Software

  • Docker
  • VirtualBox (I think?)

Setting up Docksal for the First Time

Installing Docksal

Pretty simple on OSX. Just type:

curl -fsSL get.docksal.io | sh

Starting the VM

As I understand it--at least due to current Docker limitations on non-Linux systems--Docker does spin up a single VM instance for all of its containers. So you'll need to do that.

fin vm start

Creating your first Drupal 8 Project

Go here: https://github.com/docksal/drupal8

Clone it into whatever directory you want to keep all your Docker projects; if you want them all in one location, that is. By default, the directory will be called "drupal8". Feel free to change it to whatever you'd like, but you're going to want to take note of the directory name.

From within that new directory, run:

fin up

Possible Issues

DrupalVM/Vagrant Conflict

I just had a conflict with my Vagrant, similar to what's discussed here.

When running fin vm start I got:

Configuring NFS shares...
 ERROR:  exports:8: /Users conflicts with existing export /Users/cferagotti/vagrant/myvm

I just ignored it though, and moved on to fin up. But then I got:

Starting services...
Starting drupal8_db_1
Creating drupal8_cli_1

ERROR: for db  Cannot start service db: error while mounting volume '/mnt/sda1/var/lib/docker/volumes/drupal8_project_root/_data': error while mounting volume with options: type='none' device='/Users/cferagotti/docker/drupal8' o='bind': no such file or directory

ERROR: for cli  Cannot create container for service cli: error while mounting volume with options: type='none' device='/Users/cferagotti/docker/drupal8' o='bind': no such file or directory
ERROR: Encountered errors while bringing up the project.

I edited my /etc/hosts file, commenting out the vagrant entries as the link above suggests, and it all went fine.

Naming Your Root Folder

I'm pretty sure that Docksal will allow for anything that the OS will allow, but one caveat I found is that, if you happen to use an underscore in it, the address for the site will remove it. This cost me about 15 minutes thinking that something was wrong, until I noticed that the underscore was omitted in the status during fin start.

That's It

No, really.

You now have a functional, local D8 site. Just go to http://drupal8.docksal (if you changed the directory name above, replace "drupal8" with that) and you'll have a website. Since I can't very well justify this post being so short (especially when I don't cover any kind of troubleshooting, if there is such), I'll try to explain what I can, and how else to use it.

Explaining it All

Using the Command Line

There's a good chance you're going to want to user the command line from inside your containers. To do that, just type the following from within your 

Summary

This is just a useful list of commands

Command Description
fin config Useful when you don't realize what any of the username/passwords are
fin bash Access the command line in the cli container
fin log Useful when everything breaks and you don't know why