Comments (2)
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.
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)
- Docker build broke HOT 1
- PHPMyAdmin incomplete install
- Using it on Windows HOT 5
- drush ssh password HOT 4
- Drupal Console run error HOT 1
- HTTPS HOT 2
- Docker is not building anymore because of missing default.settings.php HOT 8
- why do you remove sh? HOT 2
- Docker not building HOT 10
- Documentation: How to make mysql database persistant? HOT 1
- docker drupal images 8.2.6 and 8.2.7 HOT 2
- 403 forbidden issues & apache HOT 1
- Can not log into container. HOT 4
- I can't login to ssh HOT 4
- Install bcmath PHP module by default HOT 1
- can't pull drupal 8.5 image? HOT 3
- exceptionally slow on first page load HOT 3
- Update PHP to version 7.2 HOT 2
- Allow xdebug to accept remote connections HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-drupal.