Skip to content

Commit

Permalink
Issue geerlingguy#1451: Use 192.168.89.89 for default Docker Drupal V…
Browse files Browse the repository at this point in the history
…M IP.
  • Loading branch information
geerlingguy authored and ashabed committed Jan 18, 2018
1 parent a37c724 commit 8b3e96a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
15 changes: 8 additions & 7 deletions docs/other/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ Drupal VM can be used with [Docker](https://www.docker.com) instead of or in add

Before using Docker to run Drupal VM, you should [edit your hosts file](https://support.rackspace.com/how-to/modify-your-hosts-file/) and add the following line:

192.168.88.88 drupalvm.dev
192.168.89.89 drupalvm.dev

(Substitute the IP address and domain name you'd like to use to access your Drupal VM container.)

You can also add other subdomains if you're using other built-in services, e.g. `adminer.drupalvm.dev`, `xhprof.drupalvm.com`, etc.

> If you're using Docker for Mac, you need to perform one additional step to ensure you can access Drupal VM using a unique IP address:
>
> 1. Add an alias IP address on the loopback interface: `sudo ifconfig lo0 alias 192.168.88.88/24`
> 1. Add an alias IP address on the loopback interface: `sudo ifconfig lo0 alias 192.168.89.89/24`
> 2. When you're finished using the container, delete the alias: `sudo ifconfig lo0 -alias 192.168.89.89` (or restart your Mac).
>
> Note that you'll have to create the alias again after restarting your computer. See [this Docker (moby) issue](https://github.com/moby/moby/issues/22753#issuecomment-246054946) for more details.
> You'll have to create the alias again after restarting your Mac. See [this Docker (moby) issue](https://github.com/moby/moby/issues/22753#issuecomment-246054946) for more details.
## Method 1: Get a quick Drupal site installed with Drupal VM's Docker image

Expand Down Expand Up @@ -90,10 +91,10 @@ Run the command `docker-compose up -d` (the `-d` tells `docker-compose` to start

This command takes the instructions in the Docker Compose file and does two things:

1. Creates a custom Docker network that exposes Drupal VM on the IP address you have configured in `docker-compose.yml` (by default, `192.168.88.88`).
1. Creates a custom Docker network that exposes Drupal VM on the IP address you have configured in `docker-compose.yml` (by default, `192.168.89.89`).
2. Runs Drupal VM using the configuration in `docker-compose.yml`.

After the Drupal VM container is running, you should be able to see the Dashboard page at the VM's IP address (e.g. `http://192.168.88.88`), and you should be able to access your site at the hostname you have configured in your hosts file (e.g. `http://drupalvm.dev/`).
After the Drupal VM container is running, you should be able to see the Dashboard page at the VM's IP address (e.g. `http://192.168.89.89`), and you should be able to access your site at the hostname you have configured in your hosts file (e.g. `http://drupalvm.dev/`).

> Note: If you see Drupal's installer appear when accessing the site, that means the codebase was found, but either the database connection details are not in your local site configuration, or they are, but you don't have the default database populated yet. You may need to load in the database either via `drush sql-sync` or by importing a dump into the container. The default credentials are `drupal` and `drupal` for username and password, and `drupal` for the database name.
Expand All @@ -117,7 +118,7 @@ After you've configured your Drupal VM settings in `config.yml` and other config

This will bake a Docker images using Drupal VM's default settings for distro, IP address, hostname, etc. You can override these options (all are listed in the `provisioning/docker/bake.sh` file) by prepending them to the `composer` command:

DRUPALVM_IP_ADDRESS='192.168.88.9' DISTRO='debian9' composer docker-bake
DRUPALVM_IP_ADDRESS='192.168.89.90' DISTRO='debian9' composer docker-bake

This process can take some time (it should take a similar amount of time as it takes to build Drupal VM normally, using Vagrant and VirtualBox), and at the end, you should see a message like:

Expand All @@ -128,7 +129,7 @@ localhost : ok=210 changed=94 unreachable=0 failed=0
...done!
Visit the Drupal VM dashboard: http://192.168.88.88:80
Visit the Drupal VM dashboard: http://192.168.89.89:80
```

Once the build is complete, you can view the dashboard by visiting the URL provided.
Expand Down
6 changes: 3 additions & 3 deletions example.docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ services:
# Set this IP address to something different if you already have another
# service running on the default IP address. If you change the subnet,
# you need to also change the bridge network IP and subnet below.
ipv4_address: 192.168.88.88
ipv4_address: 192.168.89.89

networks:

# This custom network allows Drupal VM to be accessed on an IP address.
drupalvm:
driver: bridge
driver_opts:
ip: 192.168.88.1
ip: 192.168.89.1
ipam:
config:
- subnet: "192.168.88.0/16"
- subnet: "192.168.89.0/16"
2 changes: 1 addition & 1 deletion provisioning/docker/bake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
set -e

# Set variables.
DRUPALVM_IP_ADDRESS="${DRUPALVM_IP_ADDRESS:-192.168.88.88}"
DRUPALVM_IP_ADDRESS="${DRUPALVM_IP_ADDRESS:-192.168.89.89}"
DRUPALVM_MACHINE_NAME="${DRUPALVM_MACHINE_NAME:-drupal-vm}"
DRUPALVM_HOSTNAME="${DRUPALVM_HOSTNAME:-localhost}"
DRUPALVM_PROJECT_ROOT="${DRUPALVM_PROJECT_ROOT:-/var/www/drupalvm}"
Expand Down

0 comments on commit 8b3e96a

Please sign in to comment.