Difference between down and stop command? How to properly edit compose file?

  • I don't really understand the difference between the stop and down commands in the Docker Compose menu:



    Let's say I'm running a Plex Media Server inside a container and hit den "down" instead of the "stop" command. Am I going to basically erase the Plex database and have to start over, when I run the container again?


    What do I do, when I have to make an edit to the Docker Compose file? Change the path to the data volume for example. Simply stop the container, edit the compose file and restart the container again?

  • Refer to the official Docker documentation:

    docker compose down
    docs.docker.com

    docker compose stop
    docs.docker.com

    docker compose up
    docs.docker.com


    I usually modify the compose file, save it, and then run "up". The compose plugin will automatically restart the container.

    OMV 7.x | 6.8 Proxmox Kernel

    GIGABYTE Z370M DS3H Motherboard

    Intel G4560 CPU | 16G×1 Non-ECC RAM

    128G SSD + 1T SSD + 4T×2 HDD | No RAID

    500W ATX PSU | APC BK650-CH UPS

  • Here's a super quick visual for you:

    Code
    ┌──────────────────────┬───────────────────────────────────────────┐
    │ Command              │ What it does                              │
    ├──────────────────────┼───────────────────────────────────────────┤
    │ docker stop          │ Stops a running container (no removal).   │
    │                      │                                           │
    │ docker compose down  │ Stops containers + removes containers,    │
    │                      │ networks, and (optionally) volumes.       │
    └──────────────────────┴───────────────────────────────────────────┘

    Even quicker memory trick:

    Quote
    stop = pause the party,
    down = pack up and clean the house.
  • Thanks. I'm still struggling to understand how compose down affects data and settings the container has written to disk. Dockerdocs says:


    Quote

    Networks and volumes defined as external are never removed.


    Anonymous volumes are not removed by default. However, as they don’t have a stable name, they are not automatically mounted by a subsequent up. For data that needs to persist between updates, use explicit paths as bind mounts or named volumes.


    So in my example of Plex running in a container, the data written to /config would be "reused" after an down-up-circle as long as I don't change the volume paths in the compose file?


  • All those volumes are bind volumes. That means they stay on the host and will be there whatever you do on docker. You might remove the container but with the same compose.yaml they will just be there when you (re)create the container.



    Everything not bound will be lost if you (re)create the container.


    EDIT: I do not know what CHANGE_TO_COMPOSE_DATA_PATH are.


    Btw. the Settings section in your omv-compose define what is put where. I have

    1. created a shared folder appdata sitting somewhere on my zfs pool
    2. in Serivices/Compose/Settings I've specified Compose Files to use this share


    And for each container (Services/Compose/Files) it will contain a folder named after the name of the container. The root of each container is that folder.

  • So in my example of Plex running in a container, the data written to /config would be "reused" after an down-up-circle as long as I don't change the volume paths in the compose file?

    Yeah, just like the /srv/dev-disk-by-uuid-7f281e78-cec0-4bf2-a4b9-6d9003ebcb4e/Video:/data in your compose file, running "down" will not delete it.


    EDIT: I do not know what CHANGE_TO_COMPOSE_DATA_PATH are.

    You'll find it mentioned in the compose plugin settings and the Docker documentation for OMV.

    omv7:docker_in_omv [omv-extras.org]


    OMV 7.x | 6.8 Proxmox Kernel

    GIGABYTE Z370M DS3H Motherboard

    Intel G4560 CPU | 16G×1 Non-ECC RAM

    128G SSD + 1T SSD + 4T×2 HDD | No RAID

    500W ATX PSU | APC BK650-CH UPS

  • Ok. now I get it.

    It's a magical OMV variable when used in Compose/Files will be replaced by whatever is in Settings.

    In my settings it is pointed to a volume on my zfs pool but stays empty.


    The persistant storage is in appdata on another volume on another volume. Compose neatly keeps this organized by docker name so I fail to se the use case for CHANGE_TO_COMPOSE_DATA_PATH.

    • Official Post

    I fail to se the use case for CHANGE_TO_COMPOSE_DATA_PATH.

    It all depends on your intended use. For example, it can be very useful on systems with a single storage file system. If you define the variable to point to that file system, all volumes will be placed there.

    • Official Post

    so I fail to se the use case for CHANGE_TO_COMPOSE_DATA_PATH.

    Don't use it then. It is completely optional. It is just a simple way to put the path of a shared folder set on the Setting tab in your compose file without using a variable.


    The actual CHANGE_TO_COMPOSE_DATA_PATH string is only shown in the File editor in the plugin and database. When the compose file is written to the filesystem, the string is changed to the absolute path of the shared folder.


    It also allows me to set a non-named, non-relative path in the example compose files and they will just work. If I put a variable in the example compose files, people would get data in unexpected places if they forgot to set the variable. I use it in all of my compose files as well. It works quite well no matter how many filesystems you have but it does work better with a single filesystem when using the setup style of the compose wiki.

    omv 8.0.10-2 synchrony | 6.17 proxmox kernel

    plugins :: omvextrasorg 8.0.2 | kvm 8.0.7 | compose 8.1.3 | cterm 8.0 | borgbackup 8.1.6 | cputemp 8.0 | mergerfs 8.0 | scripts 8.0.1 | writecache 8.1


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!