Skip to content

[email protected] Should be modified because of pod creation disabled by default #695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yanghl12138 opened this issue May 17, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@yanghl12138
Copy link

Describe the bug
Because pod are not created by default#673, [email protected] Should be modified

This is the file generated by podman-compose systemd -a create-unit

[Unit]
Description=%i rootless pod (podman-compose)

[Service]
Type=simple
EnvironmentFile=%h/.config/containers/compose/projects/%i.env
ExecStartPre=-/usr/bin/podman-compose up --no-start
ExecStartPre=/usr/bin/podman pod start pod_%i
ExecStart=/usr/bin/podman-compose wait
ExecStop=/usr/bin/podman pod stop pod_%i

[Install]
WantedBy=default.target

The line

ExecStartPre=-/usr/bin/podman-compose up --no-start

should be

ExecStartPre=-/usr/bin/podman-compose --in-pod=1 up --no-start

To Reproduce

version: "3.1"

services:
  test:
    image: busybox
    command: sh -c "while [[ 1 ]]; do uname -msr; sleep 5; done"
sudo podman-compose systemd -a create-unit
systemctl --user daemon-reload
podman-compose systemd -a register
podman-compose down
systemctl --user start 'podman-compose@busybox'
podman pod stats 'pod_busybox'

Expected behavior
Create pod_busybox and start the service using systemd command.

Actual behavior
No pod created.

Output

> systemctl --user status 'podman-compose@busybox'
× [email protected] - busybox rootless pod (podman-compose)
     Loaded: loaded (/etc/xdg/systemd/user/[email protected]; disabled; preset: disabled)
    Drop-In: /usr/lib/systemd/user/service.d
             └─10-timeout-abort.conf
     Active: failed (Result: exit-code) since Wed 2023-05-17 11:18:51 CST; 4min 15s ago
    Process: 120985 ExecStartPre=/usr/bin/podman-compose up --no-start (code=exited, status=0/SUCCESS)
    Process: 121014 ExecStartPre=/usr/bin/podman pod start pod_busybox (code=exited, status=125)
        CPU: 801ms

May 17 11:18:49 server.fedora podman-compose[120985]: ['podman', 'network', 'exists', 'busybox_default']
May 17 11:18:49 server.fedora podman-compose[120985]: podman create --name=busybox_test_1 --label io.podman.compose.config-hash=e36d575a906>
May 17 11:18:49 server.fedora podman[121007]: 2023-05-17 11:18:49.886335646 +0800 CST m=+0.077186105 image pull beae173ccac6ad749f76713cf44>
May 17 11:18:50 server.fedora podman[121007]: 2023-05-17 11:18:50.183193284 +0800 CST m=+0.374045000 container create 6b3e3ed8dd85f507a09a9>
May 17 11:18:50 server.fedora podman-compose[121007]: 6b3e3ed8dd85f507a09a9f0b1047ea79f3e43ce1d718e5bfd974f238516fb48d
May 17 11:18:50 server.fedora podman-compose[120985]: exit code: 0
May 17 11:18:51 server.fedora podman[121014]: Error: no pod with name or ID pod_busybox found: no such pod
May 17 11:18:51 server.fedora systemd[891]: [email protected]: Control process exited, code=exited, status=125/n/a
May 17 11:18:51 server.fedora systemd[891]: [email protected]: Failed with result 'exit-code'.
May 17 11:18:51 server.fedora systemd[891]: Failed to start [email protected] - busybox rootless pod (podman-compose).
> podman pod stats 'pod_busybox'
Error: unable to get list of pods: no pod with name or ID pod_busybox found: no such pod

Environment:

  • OS: Fedora 38
  • podman version: 4.5.0
  • podman compose version: 1.0.6 (install using dnf)

Additional context

Add any other context about the problem here.

@yanghl12138 yanghl12138 added the bug Something isn't working label May 17, 2023
@StaticRocket
Copy link
Contributor

I think the systemd service is fine the way it is, the actual behavior of podman-compose needs to be adjusted such that the pod is created with the containers.

Pods are supposed to track groups of containers, the "project" should map to a single pod, assuming I'm not misinterpreting anything from the docs I've seen.

@mokibit
Copy link
Contributor

mokibit commented Jun 19, 2024

@yanghl12138 thanks for opening an issue.
The issue was fixed in #964 by adding a custom section in the compose file so the user can set the preferred value for --in-pod.
If there is no custom --in-pod value in compose file or in command line, --in-pod defaults to True so there is no need to update [email protected] file.
@p12tic the problem can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants