Git Product home page Git Product logo

Comments (2)

wrender avatar wrender commented on July 29, 2024

I don't think this would work, because the docker includes a mysql instance, database and the drupal files already inside of the container. One thing you could do is use a docker that just includes a LAMP. (Linux, Apache, MYSQL & PHP) and then mount your Drupal directory inside of it, and import your database into it using PHPMyAdmin.

from docker-drupal.

wadmiraal avatar wadmiraal commented on July 29, 2024

Well, I think it could work. It's just not that straightforward :-). And it will require either an already installed Drupal, or that you re-install it by hand.

First, the files

You can mount the Drupal code over the code in the image. Just use something like this:

docker run -v /my/local/drupal/code/:/var/www ... wadmiraal/drupal

This will override the code in the image at /var/www (where the Drupal code is located) with the code on your local machine at /my/local/drupal/code/ (or, cd inside /my/local/drupal/code/ and use -v $(pwd):/var/www, like in your example). This will of course overwrite the settings.php file; hence, you will not "use" the Drupal that was installed inside the image.

Second, MySQL

Where is your MySQL? Inside another Docker container? Or somewhere else?

If inside another container:

You can tell Docker to link containers together. Before, this was done using the --link option, like so:

docker run --link mysql_container_id:mysqlhost ... wadmiraal/drupal

This will make the MySQL container available as mysqlhost inside the wadmiraal/drupal container. So, in your Drupal settings.php file, you would put the MySQL hostname/IP as mysqlhost (instead of localhost, for example).

But now, this has been deprecated in favour of Docker networks. I have never used them, so you will need to read the documentation.

If somewhere else:

If MySQL is running on the host server/computer, you can use the IP Docker assigns to your machine. This is usually 172.17.42.1, but can vary (1st answer with a quick Google search).

If MySQL is available at any IP in your network, just use that IP. Docker has access to your network through the host.

from docker-drupal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.