Podman-compose: Difference between revisions
From wikinotes
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[podman]] s variation of [[docker-compose | [[podman]] s variation of [[docker]] docker-compose.<br> | ||
* configure overridable <code>docker run</code> params in yaml | |||
* manage multiple networked services together | |||
* less typing to interact with services (containers implied by directory) | |||
* autogenerate a systemd service that you can start with boot | |||
= Documentation = | = Documentation = | ||
<blockquote> | <blockquote> | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| github || https://github.com/containers/podman-compose | | github || https://github.com/containers/podman-compose | ||
Line 25: | Line 26: | ||
mediawiki: | mediawiki: | ||
# https://hub.docker.com/_/mediawiki | # https://hub.docker.com/_/mediawiki | ||
image: docker.io/mediawiki:1.40 | image: docker.io/mediawiki:1.40 | ||
restart: always | restart: always | ||
Line 31: | Line 32: | ||
ports: | ports: | ||
# bind container-port: 80 to localhost: 8080 | # bind container-port: 80 to localhost: 8080 | ||
# [HOST:]CONTAINER[/PROTOCOL] | |||
- 8080:80 | - 8080:80 | ||
Line 36: | Line 38: | ||
# share dir './config/images' relative to compose.yml within container at '/var/www/html/images' | # share dir './config/images' relative to compose.yml within container at '/var/www/html/images' | ||
- ./config/images:/var/www/html/images | - ./config/images:/var/www/html/images | ||
- ./data:/var/www/html/data | |||
- ./config/LocalSettings.php:/var/www/html/LocalSettings.php | - ./config/LocalSettings.php:/var/www/html/LocalSettings.php | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 45: | Line 48: | ||
pc exec ${service} bash # bash within service under key 'mediawiki' | pc exec ${service} bash # bash within service under key 'mediawiki' | ||
pc stop # stop all services from compose.yml, cleanup containers | pc stop # stop all services from compose.yml, cleanup containers | ||
pc logs ${service} # show logs for service | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- Usage --> | </blockquote><!-- Usage --> |
Latest revision as of 20:55, 24 September 2023
podman s variation of docker docker-compose.
- configure overridable
docker run
params in yaml - manage multiple networked services together
- less typing to interact with services (containers implied by directory)
- autogenerate a systemd service that you can start with boot
Documentation
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 restart: always ports: # bind container-port: 80 to localhost: 8080 # [HOST:]CONTAINER[/PROTOCOL] - 8080:80 volumes: # share dir './config/images' relative to compose.yml within container at '/var/www/html/images' - ./config/images:/var/www/html/images - ./data:/var/www/html/data - ./config/LocalSettings.php:/var/www/html/LocalSettings.phpalias 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 pc logs ${service} # show logs for service