Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
docker_notes:docker-compose [2024-07-13 Sat wk28 09:18] – [References] baumkpdocker_notes:docker-compose [2026-05-23 Sat wk21 19:14] (current) – [Installation / Update] baumkp
Line 1: Line 1:
-{{tag>linux docker compose docker-compose "docker compose" container network nftables iptables nft}}+{{tag>linux docker compose docker-compose "docker compose" container network}}
 ======Docker-Compose====== ======Docker-Compose======
     *Docker Docs [[https://docs.docker.com/compose/compose-file/|Compose specification]], [[https://github.com/compose-spec/compose-spec/blob/master/spec.md#version-and-name-top-level-elements|The Compose Specification]]     *Docker Docs [[https://docs.docker.com/compose/compose-file/|Compose specification]], [[https://github.com/compose-spec/compose-spec/blob/master/spec.md#version-and-name-top-level-elements|The Compose Specification]]
Line 6: Line 6:
   ***''docker-compose pull'', it would seem this is required to ensure the latest image(s) is downloaded**   ***''docker-compose pull'', it would seem this is required to ensure the latest image(s) is downloaded**
   *''%%docker-compose up -d --build --force-recreate%%''   *''%%docker-compose up -d --build --force-recreate%%''
-    * ''-d''+    * ''-d'' run as deamon (in background)
     * ''%%--build%%'' on required if the compose includes building an image     * ''%%--build%%'' on required if the compose includes building an image
     * ''%%--force-recreate%%''     * ''%%--force-recreate%%''
Line 12: Line 12:
   *''docker-compose stop|start|restart'' it is better to use down and up commands has they force the recreation of the container (no image). This is as the scripts on start-up usually assume a new container.   *''docker-compose stop|start|restart'' it is better to use down and up commands has they force the recreation of the container (no image). This is as the scripts on start-up usually assume a new container.
   *''%%docker-compose build --pull%%'', will pull the latest images and rebuild a Docker file.   *''%%docker-compose build --pull%%'', will pull the latest images and rebuild a Docker file.
 +
 +====Docker Compose Versions/Types====
 +Docker compose can be installed as a specific program and run as ''docker-compose'' to it can be run as an add-in to docker and run as ''docker compose'' Not sure of the advantages of one over the other, however the latest version of the separate program ''docker-compose'' can be directly downloaded as described below, whereas the ''docker compose'' add-in is via distribution package manager.  Ultimately both methods seem to be functional.
 =====Installation / Update===== =====Installation / Update=====
 To check current version: ''%%docker-compose --version%%'' To check current version: ''%%docker-compose --version%%''
Line 17: Line 20:
 The latest version of docker-compose can be check here: [[https://github.com/docker/compose/releases | git hub docker compose releases]] change the version sub-directory as required. The latest version of docker-compose can be check here: [[https://github.com/docker/compose/releases | git hub docker compose releases]] change the version sub-directory as required.
 <code bash> <code bash>
-sudo curl -L "https://github.com/docker/compose/releases/download/v2.28.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose+sudo curl -L "https://github.com/docker/compose/releases/download/v5.1.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose 
 +</code> 
 +<code bash>
 sudo chmod +x /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
 </code> </code>
- 
   *[[https://gdevillele.github.io/compose/install/|Install Docker Compose]]   *[[https://gdevillele.github.io/compose/install/|Install Docker Compose]]
   *Install Docker Engine : [[https://docs.docker.com/engine/install/|Docker Engine]]   *Install Docker Engine : [[https://docs.docker.com/engine/install/|Docker Engine]]
Line 65: Line 69:
  
 ====Docker external named volumes==== ====Docker external named volumes====
-Docker compose external named volumes can be used across the Docker installation and they need to be created by the user (otherwise fails) using the docker volume create command. (References: [[http://sefidian.com/2021/11/05/volumes-in-docker-compose-tutorial/|Volumes in Docker Compose tutorial]], [[https://devopscell.com/docker/docker-compose/volumes/2018/01/16/volumes-in-docker-compose.html|Using volumes in Docker Compose]])+Docker compose external named volumes can be used across the Docker installation and they need to be created by the user (otherwise fails) using the docker volume create command. (References: [[https://web.archive.org/web/20221124135235/http://sefidian.com/2021/11/05/volumes-in-docker-compose-tutorial/|Volumes in Docker Compose tutorial]], [[https://web.archive.org/web/20240719050727/https://devopscell.com/docker/docker-compose/volumes/2018/01/16/volumes-in-docker-compose.html|Using volumes in Docker Compose]])
  
 Example: Example:
Line 172: Line 176:
     * [[https://docs.docker.com/compose/compose-file/|Compose Specification Overview]]     * [[https://docs.docker.com/compose/compose-file/|Compose Specification Overview]]
     * [[https://docs.docker.com/reference/dockerfile/|Dockerfile reference]]     * [[https://docs.docker.com/reference/dockerfile/|Dockerfile reference]]
 +    * [[https://github.com/compose-spec/compose-spec/tree/main|compose specification]]
   * [[https://unix.stackexchange.com/questions/246935/set-systemd-service-to-execute-after-fstab-mount|Set systemd service to execute after fstab mount]]   * [[https://unix.stackexchange.com/questions/246935/set-systemd-service-to-execute-after-fstab-mount|Set systemd service to execute after fstab mount]]
   * [[https://unix.stackexchange.com/questions/398540/how-to-override-systemd-unit-file-settings|How to override systemd unit file settings?]]   * [[https://unix.stackexchange.com/questions/398540/how-to-override-systemd-unit-file-settings|How to override systemd unit file settings?]]