-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DOCS] Amend docs about using docker-compose stop instead of docker-compose down #289
Conversation
docs/dev/docker-setup.md
Outdated
@@ -57,6 +57,10 @@ for development environments. | |||
|
|||
* `docker-compose up` | |||
|
|||
* Use `docker-compose stop` to stop the container (without removing the volumes). | |||
|
|||
> Don't use `docker-compose down` to temporarily stop the container. If you do, the volumes will be removed, meaning that the contents of your DB will be lost. After using `docker-compose stop`, continue to use `docker-compose up` to bring the container and volumes up as before, and the DB will still exist and work as expected. (See https://stackoverflow.com/questions/46428420/docker-compose-up-down-stop-start-difference and https://forums.docker.com/t/why-docker-compose-down-deletes-my-volume-how-to-define-volume-as-external/67433/11) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better off clarifying that docker-compose up
is to be done in the first instance, then docker-compose start
and docker-compose stop
for routine work on the project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes good point. I'll make that change, and squash the commits also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated @jonny-bull
daf9a19
to
b59edc5
Compare
docs/dev/docker-setup.md
Outdated
@@ -55,7 +55,13 @@ for development environments. | |||
|
|||
> This only needs to be called once to build the image(s) | |||
|
|||
* `docker-compose up` | |||
* `docker-compose up` first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to be more verbose here.
Use
docker-compose up
to build the containers. You'll only need to use this the first time.
Can probably remove the line above as a bonus
docs/dev/docker-setup.md
Outdated
|
||
* Use `docker-compose stop` to stop the container (without removing the volumes). | ||
|
||
> Don't use `docker-compose down` to temporarily stop the container. If you do, the volumes will be removed, meaning that the contents of your DB will be lost. After using `docker-compose stop`, continue to use `docker-compose start` to bring the container and volumes up as before, and the DB will still exist and work as expected. (See https://stackoverflow.com/questions/46428420/docker-compose-up-down-stop-start-difference and https://forums.docker.com/t/why-docker-compose-down-deletes-my-volume-how-to-define-volume-as-external/67433/11) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line can be cut down significantly more now you've added in the lines above
Using
docker-compose down
stops containers but also removes them. This will lead to loss of data.
(You know, you can still use docker-compose down
but be aware of the risk involved)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, very useful, I was struggling to be less verbose. Incorporating those changes now 👍
b59edc5
to
5c754d4
Compare
Another thing to consider if data loss in this way remains a problem is storing the db volume on the host, e.g. https://github.com/symfony/recipes/blob/main/doctrine/doctrine-bundle/2.4/manifest.json#L35-L36 |
Added note in docker-setup to add learning about docker-compose down preventing DB being lost.