N
N
nathan1117772021-08-07 19:49:03
Drupal
nathan111777, 2021-08-07 19:49:03

What is the right way to make changes to docker-compose.yml and project files if the containers are already running?

I installed Docker and Docker Composer and downloaded the latest release from github

Docker based Drupal stack.
https://github.com/wodby/docker4drupal
where
images for Drupal9
there are images php, mariadb, apache, etc. and put it in the project folder /var/www/html/mydrupaldocker, and after running the images from this folder, as well as adding the drupal9 folder to the project folder, I will start installing drupal 9 in the browser.

Then I made the settings in the files .envand docker-compose.ymllaunched the container with the command:
docker-compose up -d

I do everything according to the video:
https://www.youtube.com/watch?v=VEIOmxAnoTg
You can take a quick look somewhere from 25 minutes.

And I have a question about two scenarios for the development of events:
---------------------------------------- -------------------------------------------------- ------------------------------------------------------
Situation #1 :

I made mistakes:
1. In the file docker-compose.ymlI have a commented code that is responsible for the php image. Accordingly, the php container was not started.
2. The docker-compose.ymltraefik is incorrectly configured in the file. And an error is thrown.
3. I want to place the project in another place on the computer (not critical, but desirable)

Can do:
docker-compose stop    // остановить запущенные контейнеры
docker-compose rm // удалить остановленные контейнеры

Fix whatever is needed. And run again:

docker-compose up -d

So do it right? Or do you need something different?
-------------------------------------------------- -------------------------------------------------- ----------------------------------------
Situation No. 2:

Everything is set up well, I started everything necessary containers, installed Drupal 9 site in a container. And then I created a sub theme, added content using the Drupal admin and, accordingly, I added entries in the database, wrote code in php, js, css files, etc.

How can I commit the changes now? What commands should be written in the terminal?
For example, in a technology such as git, this is done with the commands:
git add .
git commit -m "first"

How is this done in Docker? Perhaps there will be a situation when I need to roll back the container to a lower version.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Drno, 2021-08-07
@nathan111777

1. The easiest option is to stop the containers, make changes, start over again. They will start with a new config
2. If the containers are standard, then changes to them are written as in a regular database. That is, constantly

P
po47, 2021-08-15
@po47

docker-compose stop
change docker-compose.yml
docker-compose up --build

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question