Podman-compose: Difference between revisions

From wikinotes
No edit summary
Line 24: Line 24:
services:
services:
   mediawiki:
   mediawiki:
     image: mediawiki
    # https://hub.docker.com/_/mediawiki
     image: docker.io/mediawiki:1.40-fpm
 
     restart: always
     restart: always
     ports:
     ports:
      # bind container-port: 80 to localhost: 8080
       - 8080:80
       - 8080:80
     volumes:
     volumes:
       - config/images:/var/www/html/images
      # share dir './config/images' relative to compose.yml within container at '/var/www/html/images'
       - config/LocalSettings.php:/var/www/html/LocalSettings.php
       - ./config/images:/var/www/html/images
       - ./config/LocalSettings.php:/var/www/html/LocalSettings.php
</syntaxhighlight>
</syntaxhighlight>



Revision as of 18:54, 24 September 2023

podman s variation of docker-compose.
Using a base-image, configure docker-run via a yaml file.
You may also use it to start multiple related services at once.

Documentation

official docs https://docs.podman.io/en/latest/markdown/podman-compose.1.html
github https://github.com/containers/podman-compose
(yaml) compose spec https://github.com/compose-spec/compose-spec/blob/master/spec.md#compose-file

Example

# ${PROJECT}/compose.yml

version: '3'
services:
  mediawiki:
    # https://hub.docker.com/_/mediawiki
    image: docker.io/mediawiki:1.40-fpm

    restart: always

    ports:
      # bind container-port: 80 to localhost: 8080
      - 8080:80

    volumes:
      # share dir './config/images' relative to compose.yml within container at '/var/www/html/images'
      - ./config/images:/var/www/html/images
      - ./config/LocalSettings.php:/var/www/html/LocalSettings.php
alias pc='sudo podman-compose'
pc up -d                 # start all services from compose.yml
pc ps                    # list all started services
pc exec ${service} bash  # bash within service under key 'mediawiki'
pc stop                  # stop all services from compose.yml, cleanup containers