glaux / drupal8docker

A minimal development environment for drupal 8 with drush and phpmyadmin using docker
11 stars 3 forks source link

Clone Docker #1

Open lexsoft00 opened 6 years ago

lexsoft00 commented 6 years ago

Hi,

I'm new to Docker, tried your config and works very good.

I would like to clone the containers like from dev1 to dev2 so I can try something on dev2 but would like to keep the settings from dev1, I see that you can do a fresh start, but I only want to reach dev1 stable and then clone dev1 to dev2 dev3 dev4 and try different things. Since the script is making more than 1 container, do you know an easy way to group the containers and clone them?

glaux commented 6 years ago

I'm not completely sure what you want to do, but if I understand correctly you would like to test several drupal installations on the same general server settings?

I think I would just copy the project folder to 'project2' and change line 6 in the docker-compose file to reflect this change. when you spin up the system with docker-compose up the new drupal project will be built. Note however that the new installation would use the same database unless you modify that in the compose file as well, but at that point it might be easier to start the containers directly from docker cli (I've never done this myself, but there are a lot of guides on this on the web).

lexsoft00 commented 6 years ago

Would you mind setting up an example? What you are saying is right I would like to have more projects running on the same general server.

I've done the changes in docker-compose file but when I do docker-compose up it's still running the first project and not adding the image for the second project.

Could you post the changes here or do a git patch?

Thanks

glaux commented 6 years ago

Take a look at the branch 'multiple' that contains my idea.

It works somewhat, but they are alle sharing the same database, and that messes with the drupal cache. But since the mysql-container have persistent storage, you might just set up the databases for the projects manually after the first run of docker-compose up.

I had to duplicate the environment config file, soft linking doesn't work, and the environment file has to be within the project folder to be included in the image (to have the values copied to settings.php). That is definitely not optimal.

That's the best I can do for now I'm afraid, I'm no expert either :P

lexsoft00 commented 6 years ago

Seems that they share the same drupal base code and the same database. I will try to spend some time to see if I can work something.

Also did manage to add drupal console to the project and works great. To the drupal docker file I've added the following code:

Install Drupal Console

RUN curl https://drupalconsole.com/installer -L -o drupal.phar && \ mkdir /usr/local/bin/drupal && \ mv drupal.phar /usr/local/bin/drupal && \ chmod +x /usr/local/bin/drupal && \ sed -i '$ a alias drupal="php /usr/local/bin/drupal/drupal.phar"' ~/.bashrc

You still need to install with composer the drupal console in the HTML folder but the drupal launcher works.

I've tried logging in the PHPMyAdmin but can't seem to login with root, only with drupal user.

Also, i wanted to thank you for your work. I've tried the wodby docker for drupal, it works fine, it's just so slow on my computer. Compared to this docker I would say that wodby is 3 times slower. I am running on a mini mac on IOS High Sierra.