Skip to content
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

pod creation disabled by default #673

Closed
mawe42 opened this issue Apr 12, 2023 · 8 comments
Closed

pod creation disabled by default #673

mawe42 opened this issue Apr 12, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@mawe42
Copy link

mawe42 commented Apr 12, 2023

Since commit f6dbce3, podman-compose has switched the default behaviour for creating a pod. Before this change, there was a --no-pod option with default False. Now there is a --in-pod option with default False.

If this change was intentional, then it might be good to advertise / document it somewhere IMHO. But I would think having --in-pod default to True to keep backwards compatible would be very good for existing users (including me...)

@mawe42 mawe42 added the bug Something isn't working label Apr 12, 2023
@muayyad-alsadi
Copy link
Collaborator

The last stable 1.0.3 and current stable 1.0.6 have same behavior which is no pod by default

The next stable would have pod creation enabled by default. I believe pod creation is good default.

Any suggestion?

@muayyad-alsadi
Copy link
Collaborator

The reason of confusion that many people were using the devel branch because we took too much time to release new stable.

@mawe42
Copy link
Author

mawe42 commented Apr 12, 2023

Ah I see, thanks! Yes, we - as many others - have been using the devel branch because the stable 1.0.3 release wasn't working for us. I would definitely vote for pod creation by default.

@HerrFrutti
Copy link

HerrFrutti commented Apr 13, 2023

I don't understand this... I've been reading though the issues and there are suggested solutions that are not working (anymore?).

For example this is not working (for me):

@jayache80 you can no choose to not create pod or create pod with whatever arguments you want

#442 (comment)

podman-compose --no-pod up -d
# or
podman-compose --pod-args='--infra=false --share=""' up -d
# or
podman-compose --pod-args='--infra=true --share=""' up -d

I'm new to podman and podman-compose and want that my compose file creates a pod. Nothing I've found helped me so far.

Running on stable, installed through dnf install.

using podman version: 4.4.4
podman-composer version  1.0.3
podman --version
podman version 4.4.4

Sorry if this is the wrong place, but I did not want to open another issue, with the same problem.

@muayyad-alsadi
Copy link
Collaborator

muayyad-alsadi commented Apr 13, 2023

podman-composer version 1.0.3

we have just released a newer stable version 1.0.6, please update to that version
using

sudo pip install --upgrade podman-compose

you can use --user if you don't want to use sudo

in the latest stable version

podman-compose --in-pod=0 up -d # .... if you don't want pod  # this is the the current 1.0.x default
podman-compose --in-pod=1 up -d # .... if you want pod # the default in devel might be default in 1.1.x

@HerrFrutti
Copy link

that does the trick. Thank you.

When running podman-compose down the containers get removed, but the pod remains. Is that on purpose?

When recreating the pod while all containers are running, works as expected!

@yozachar
Copy link

yozachar commented May 1, 2023

compose.yaml
secrets:
  nextcloud-admin-password:
    environment: ${nextcloud_admin_password}
    external: true
  nextcloud-admin-user:
    environment: ${nextcloud_admin_user}
    external: true
  postgres-db:
    environment: ${postgres_db}
    external: true
  postgres-password:
    environment: ${postgres_password}
    external: true
  postgres-user:
    environment: ${postgres_user}
    external: true

volumes:
  pgdb:
  nextcloud:


services:
  db:
    container_name: nc_home_db
    image: docker.io/postgres
    restart: always
    environment:
      POSTGRES_DB: /run/secrets/postgres_db
      POSTGRES_USER: /run/secrets/postgres_user
      POSTGRES_PASSWORD: /run/secrets/postgres_password
    secrets:
      - postgres-db
      - postgres-password
      - postgres-user
    volumes:
      - pgdb:/var/lib/postgresql/data

  app:
    container_name: nc_home_app
    image: docker.io/nextcloud
    restart: always
    ports:
      - 8080:80
    depends_on:
      - db
    environment:
      POSTGRES_HOST: db
      POSTGRES_DB: /run/secrets/postgres_db
      POSTGRES_USER: /run/secrets/postgres_user
      POSTGRES_PASSWORD: /run/secrets/postgres_password
      NEXTCLOUD_ADMIN_PASSWORD: /run/secrets/nextcloud_admin_password
      NEXTCLOUD_ADMIN_USER: /run/secrets/nextcloud_admin_user
    secrets:
      - nextcloud-admin-password
      - nextcloud-admin-user
      - postgres-db
      - postgres-password
      - postgres-user
    volumes:
      - nextcloud:/var/www/html
Before composing
$ psl # my custom zsh function, simply lists every podman entity
Pods:
POD ID        NAME        STATUS      CREATED     INFRA ID    # OF CONTAINERS
5e275d17517f  pod_denv    Created     4 days ago              1

Containers:
CONTAINER ID  IMAGE               COMMAND         CREATED     STATUS      PORTS       NAMES
d0f80548f8b5  localhost/apex:dev  sleep infinity  4 days ago  Created                 apex-dev

Images:
REPOSITORY                   TAG         IMAGE ID      CREATED      SIZE
localhost/apex               dev         7a519c914bdf  4 days ago   259 MB
docker.io/clux/muslrust      stable      8688b95e10fb  6 days ago   1.43 GB
docker.io/library/nextcloud  latest      68294f5fded5  10 days ago  1.03 GB
docker.io/library/postgres   latest      ceccf204404e  2 weeks ago  387 MB
docker.io/library/python     slim        d74a102e9001  2 weeks ago  133 MB

Volumes:
DRIVER      VOLUME NAME
local       apex-vol
local       nc_home_db
local       nc_home_nextcloud

Networks:
NETWORK ID    NAME             DRIVER
ceaa028c0368  denv_default     bridge
6fba484c2cc9  nc_home_default  bridge
2f259bab93aa  podman           bridge

Secrets:
ID                         NAME                      DRIVER      CREATED      UPDATED
2db662c577630c8eaea38ef06  postgres-user             file        4 hours ago  4 hours ago
41807b280f34fdfa8e0b30bee  postgres-db               file        4 hours ago  4 hours ago
c98f71010cf323c8a2925de34  postgres-password         file        4 hours ago  4 hours ago
f5b1b6e8e5041fa5a76fad9d3  nextcloud-admin-user      file        4 hours ago  4 hours ago
fc5d76a0bf5f3759d6f490185  nextcloud-admin-password  file        4 hours ago  4 hours ag

Compose steps:

$ . ./secrets.env # sets the environment variables
$ podman-compose -p SH --pod-args '--name NC --infra true' -f ./compose.yaml up -d
Error
podman-compose version: 1.0.7
['podman', '--version', '']
using podman version: 4.5.0
** excluding:  set()
['podman', 'ps', '--filter', 'label=io.podman.compose.project=SH', '-a', '--format', '{{ index .Labels "io.podman.compose.config-hash"}}']
podman pod create --name=pod_SH --name NC --infra true
Error: cannot specify --name and NAME at the same time
exit code: 125
podman volume inspect SH_pgdb || podman volume create SH_pgdb
['podman', 'volume', 'inspect', 'SH_pgdb']
Error: inspecting object: no such volume SH_pgdb
['podman', 'volume', 'create', '--label', 'io.podman.compose.project=SH', '--label', 'com.docker.compose.project=SH', 'SH_pgdb']
['podman', 'volume', 'inspect', 'SH_pgdb']
['podman', 'network', 'exists', 'SH_default']
['podman', 'network', 'create', '--label', 'io.podman.compose.project=SH', '--label', 'com.docker.compose.project=SH', 'SH_default']
['podman', 'network', 'exists', 'SH_default']
podman run --name=nc_home_db -d --pod=pod_SH --label io.podman.compose.config-hash=cfa745dc9fae03906b2cf95a11ac380a242d5c2be38990f15a0ad4b2c65ec016 --label io.podman.compose.project=SH --label io.podman.compose.version=1.0.7 --label [email protected] --label com.docker.compose.project=SH --label com.docker.compose.project.working_dir=/home/us-er/Documents/03-Workspace/04-Software-Database/Containers/NextCloud --label com.docker.compose.project.config_files=./compose.yaml --label com.docker.compose.container-number=1 --label com.docker.compose.service=db -e POSTGRES_DB=/run/secrets/postgres_db -e POSTGRES_USER=/run/secrets/postgres_user -e POSTGRES_PASSWORD=/run/secrets/postgres_password -v SH_pgdb:/var/lib/postgresql/data --net SH_default --network-alias db --secret postgres-db --secret postgres-password --secret postgres-user --restart always docker.io/postgres
Error: no pod with name or ID pod_SH found: no such pod
exit code: 125
podman start nc_home_db
Error: no container with name or ID "nc_home_db" found: no such container
exit code: 125
podman volume inspect SH_nextcloud || podman volume create SH_nextcloud
['podman', 'volume', 'inspect', 'SH_nextcloud']
Error: inspecting object: no such volume SH_nextcloud
['podman', 'volume', 'create', '--label', 'io.podman.compose.project=SH', '--label', 'com.docker.compose.project=SH', 'SH_nextcloud']
['podman', 'volume', 'inspect', 'SH_nextcloud']
['podman', 'network', 'exists', 'SH_default']
podman run --name=nc_home_app -d --pod=pod_SH --requires=nc_home_db --label io.podman.compose.config-hash=cfa745dc9fae03906b2cf95a11ac380a242d5c2be38990f15a0ad4b2c65ec016 --label io.podman.compose.project=SH --label io.podman.compose.version=1.0.7 --label [email protected] --label com.docker.compose.project=SH --label com.docker.compose.project.working_dir=/home/us-er/Documents/03-Workspace/04-Software-Database/Containers/NextCloud --label com.docker.compose.project.config_files=./compose.yaml --label com.docker.compose.container-number=1 --label com.docker.compose.service=app -e POSTGRES_HOST=db -e POSTGRES_DB=/run/secrets/postgres_db -e POSTGRES_USER=/run/secrets/postgres_user -e POSTGRES_PASSWORD=/run/secrets/postgres_password -e NEXTCLOUD_ADMIN_PASSWORD=/run/secrets/nextcloud_admin_password -e NEXTCLOUD_ADMIN_USER=/run/secrets/nextcloud_admin_user -v SH_nextcloud:/var/www/html --net SH_default --network-alias app --secret nextcloud-admin-password --secret nextcloud-admin-user --secret postgres-db --secret postgres-password --secret postgres-user -p 8080:80 --restart always docker.io/nextcloud
Error: no pod with name or ID pod_SH found: no such pod
exit code: 125
podman start nc_home_app
Error: no container with name or ID "nc_home_app" found: no such container
exit code: 125

Error highlight:

['podman', 'ps', '--filter', 'label=io.podman.compose.project=SH', '-a', '--format', '{{ index .Labels "io.podman.compose.config-hash"}}']
podman pod create --name=pod_SH --name NC --infra true
Error: cannot specify --name and NAME at the same time
exit code: 125
After composing
$ psl
Pods:
POD ID        NAME        STATUS      CREATED     INFRA ID    # OF CONTAINERS
5e275d17517f  pod_denv    Created     4 days ago              1

Containers:
CONTAINER ID  IMAGE               COMMAND         CREATED     STATUS      PORTS       NAMES
d0f80548f8b5  localhost/apex:dev  sleep infinity  4 days ago  Created                 apex-dev

Images:
REPOSITORY                   TAG         IMAGE ID      CREATED      SIZE
localhost/apex               dev         7a519c914bdf  4 days ago   259 MB
docker.io/clux/muslrust      stable      8688b95e10fb  6 days ago   1.43 GB
docker.io/library/nextcloud  latest      68294f5fded5  10 days ago  1.03 GB
docker.io/library/postgres   latest      ceccf204404e  2 weeks ago  387 MB
docker.io/library/python     slim        d74a102e9001  2 weeks ago  133 MB

Volumes:
DRIVER      VOLUME NAME
local       SH_nextcloud
local       SH_pgdb
local       apex-vol
local       nc_home_db
local       nc_home_nextcloud

Networks:
NETWORK ID    NAME             DRIVER
a0536e02ca7f  SH_default       bridge
ceaa028c0368  denv_default     bridge
6fba484c2cc9  nc_home_default  bridge
2f259bab93aa  podman           bridge

Secrets:
ID                         NAME                      DRIVER      CREATED      UPDATED
2db662c577630c8eaea38ef06  postgres-user             file        4 hours ago  4 hours ago
41807b280f34fdfa8e0b30bee  postgres-db               file        4 hours ago  4 hours ago
c98f71010cf323c8a2925de34  postgres-password         file        4 hours ago  4 hours ago
f5b1b6e8e5041fa5a76fad9d3  nextcloud-admin-user      file        4 hours ago  4 hours ago
fc5d76a0bf5f3759d6f490185  nextcloud-admin-password  file        4 hours ago  4 hours ag

I think this is a bug, on pod creation, or am I doing something wrong?

@mokibit
Copy link
Contributor

mokibit commented Jun 19, 2024

@mawe42 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.
@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

6 participants