containers / containers/podman-compose

Crash on Empty Ports Specification

Open
#160 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6.2k
Forks
622
PR merge metrics
No merged PRs in 30d

Description

If you define a ports section, but leave it empty. It will cause podman-compose to crash on "up" command.

example yml:

```yml
version: "3"

services:
flask-service:
build: ./flask
container_name: flask-service
restart: always

# notice, we added a "z" so that we can be changing the
# file in the directory, and it will change in the container
volumes:
- ./flask/app:/opt/flask:z
ports:
# using internal port to communicate to webserver
# - 9090:9090
```
Fixed it like so (around line 465 in version 0.1.5):

```python
# added this extra check
if not (cnt.get('ports') is None):
for i in cnt.get('ports', []):
podman_args.extend(['-p', i])
```
This is probably not the only place this happens, probably other empty sections will cause the same crash. Maybe the yml parser should be more strict and give an appropriate error message like: ERROR: Ports section is empty.

This is version 0.1.5.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.