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

Podman-compose is not handling networks: RuntimeError: missing networks: #463

Open
Reizake opened this issue Mar 28, 2022 · 17 comments
Open
Labels

Comments

@Reizake
Copy link

Reizake commented Mar 28, 2022

When trying to make a static IP setting based specifically on this documentation under the "ipv4_address, ipv6_address" section:
https://docs.docker.com/compose/compose-file/compose-file-v3/

I am receiving the "RuntimeError: missing networks: default,podman" error. I have tried a variety of other methods to no avail. it seems that podman-compose is not properly reading the networks: section in the yaml

here is my compose file:

version: '3'

networks:
  default:
    external:
      name: podman
  podman:
    ipam:
      driver: default
      config:
        - subnet: "10.88.2.0/24"


services:

  app:
    image: nextcloud
    restart: always
    volumes:
      - ./nextcloud:/var/www/html 
    environment:
      - MYSQL_PASSWORD=xxxx
      - MYSQL_DATABASE=xxxx
      - MYSQL_USER=xxxx
      - MYSQL_HOST=xxxx
    networks:
      podman:
           ipv4_address:10.88.2.10

  db:
    image: mariadb
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - ./db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=xxxx
      - MYSQL_PASSWORD=xxxx
      - MYSQL_DATABASE=xxxx
      - MYSQL_USER=xxxx
    networks:
     podman:
          ipv4_address:10.88.2.11

And here are the results I get:

User@Computer:/DAS/PodmanVolumes/nextcloud$ sudo podman-compose  up -d
['podman', '--version', '']
using podman version: 3.2.1
Traceback (most recent call last):
  File "/usr/local/bin/podman-compose", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/podman_compose.py", line 1775, in main
    podman_compose.run()
  File "/usr/local/lib/python3.9/dist-packages/podman_compose.py", line 1022, in run
    self._parse_compose_file()
  File "/usr/local/lib/python3.9/dist-packages/podman_compose.py", line 1128, in _parse_compose_file
    raise RuntimeError(f"missing networks: {missing_nets_str}")
RuntimeError: missing networks: default,podman

I have tried using default as well as "network_mode" neither gave good results.
please let me know if there is any other info needed or things you would like me to try.

@Reizake Reizake added the bug Something isn't working label Mar 28, 2022
@muayyad-alsadi muayyad-alsadi added Support and removed bug Something isn't working labels Mar 29, 2022
@muayyad-alsadi
Copy link
Collaborator

Question?

what version of podman-compose are you using?

NOTE

the external part in networks mean you need to manage it yourself, you should create this network, see compose spec

here is an example how to specify static ip

version: "3"
networks:
  app1_container_network:
    ipam:
      driver: default
      config:
        - subnet: "172.20.0.0/16"
services:
  app1:
    image: busybox
    command: httpd -f -p 8080 -h /etc/
    networks:
      app1_container_network:
        ipv4_address: 172.20.0.11

NOTE 2

specifying address is against the 12 factor you should use port mapping not ip address mapping.

@Reizake
Copy link
Author

Reizake commented Mar 29, 2022

I am running:

['podman', '--version', '']
using podman version: 3.2.1
podman-composer version  1.0.3
podman --version 
podman version 3.2.1
exit code: 0

just to confirm. this will still put it in the pre-existing network "podman" correct?

Either way when I set my compose file as such:

version: '3'

networks:
  podman:
    ipam:
      driver: default
      config:
        - subnet: "10.88.2.0/24"


services:

  app:
    image: nextcloud
    restart: always
    volumes:
      - ./nextcloud:/var/www/html 
    environment:
      - MYSQL_PASSWORD=xxxx
      - MYSQL_USER=xxxx
      - MYSQL_HOST=xxxx
    networks:
       podman:
           ipv4_address:10.88.2.10

  db:
    image: mariadb
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - ./db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=xxxx
      - MYSQL_PASSWORD=xxxx
      - MYSQL_DATABASE=xxxx
      - MYSQL_USER=xxxx
    networks:
       podman:
          ipv4_address:10.88.2.11

it still spits this error:

user@computer:/DAS/PodmanVolumes/nextcloud$ sudo podman-compose  up -d
['podman', '--version', '']
using podman version: 3.2.1
Traceback (most recent call last):
  File "/usr/local/bin/podman-compose", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/podman_compose.py", line 1775, in main
    podman_compose.run()
  File "/usr/local/lib/python3.9/dist-packages/podman_compose.py", line 1022, in run
    self._parse_compose_file()
  File "/usr/local/lib/python3.9/dist-packages/podman_compose.py", line 1128, in _parse_compose_file
    raise RuntimeError(f"missing networks: {missing_nets_str}")
RuntimeError: missing networks: podman

@muayyad-alsadi
Copy link
Collaborator

would you please try latest branch.

pip3 install https://github.com/containers/podman-compose/archive/devel.tar.gz

I've tested it with equivalent yaml and it worked

---
version: "3"
networks:
  podman:
    ipam:
      driver: default
      config:
        - subnet: "10.88.2.0/24"
services:
  web1:
    image: busybox
    command: httpd -f -p 8080 -h /etc/
    networks:
      podman:
        ipv4_address: 10.88.2.10
  web2:
    image: busybox
    command: httpd -f -p 8080 -h /etc/
    networks:
      podman:
        ipv4_address: 10.88.2.11

@Reizake
Copy link
Author

Reizake commented Mar 30, 2022

updating to the newest version fixed it. just for reference when wanting to use a pre-existing network you can ley it out as such:

networks:
  podman:
    external:
      name: podman


services:

  app:
    image: nextcloud
    restart: always
    volumes:
      - ./nextcloud:/var/www/html 
    environment:
      - MYSQL_PASSWORD=xxxx
      - MYSQL_DATABASE=xxxx
      - MYSQL_USER=xxxx
      - MYSQL_HOST=xxxx
    networks:
       podman:
         ipv4_address: 10.88.2.10
  db:
    image: mariadb
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - ./db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=xxxx
      - MYSQL_PASSWORD=xxxx
      - MYSQL_DATABASE=xxxx
      - MYSQL_USER=xxxx
    networks:
        podman:
          ipv4_address: 10.88.2.11

I also notice it puts my containers in a pod now, which I like, but is there a command to stop that from happening in the compose file. or just a general way of setting pod configuration?

@muayyad-alsadi
Copy link
Collaborator

, but is there a command to stop that from happening in the compose file. or just a general way of setting pod configuration?

to prevent creating a pod

  --no-pod              disable pod creation

to adjust pod params

  --pod-args pod_args   disable pod creation

there is no way to control that from inside the yaml

@jave
Copy link

jave commented May 8, 2022

Just a note that upgrading to podman-compose 1.0.4 fixed the same problem for me

@mchoeti
Copy link

mchoeti commented Nov 11, 2022

there is no way to control that from inside the yaml
Hm... but doing this
podman-compose up --no-pod

results in
unrecognized arguments: --no-pod

Do you have an example?

@dpward
Copy link

dpward commented Jan 25, 2023

updating to the newest version fixed it.

For those finding this online and looking to backport a patch: the issue originally described here was #399, which was fixed with 4aa08cd.

@bigon
Copy link

bigon commented Jan 30, 2023

Any plan to do a new release?

@midu16
Copy link

midu16 commented Feb 27, 2023

@muayyad-alsadi is there any plan on the podman-compose 1.0.4 rpm release? Fedora 37 is still using the 1.0.3.

@mreiche
Copy link

mreiche commented Sep 8, 2023

I'm facing the same issue with newer versions:

podman-compose --version

podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 3.4.4
podman-compose version 1.0.6
podman --version
podman version 3.4.4
exit code: 0
podman-compose up

 Error tearing down partially created network namespace for container c43...c48: CNI network "my_bridge" not found

The network itself was created and exists:

podman network ls

WARN[0000] Error validating CNI config file /etc/cni/net.d/my_bridge.conflist: [plugin bridge does not support config version "1.0.0" plugin portmap does not support config version "1.0.0" plugin firewall does not support config version "1.0.0" plugin tuning does not support config version "1.0.0"]
NETWORK ID    NAME           VERSION     PLUGINS
2f259bab93aa  podman         0.4.0       bridge,portmap,firewall,tuning
177b12cc34e2  my_bridge  1.0.0       bridge,portmap,firewall,tuning,dnsname

Edit: It only works when I use the preconfigured bridge network podman.

networks:
  my_bridge:
    external:
      name: podman

@Antoniossss
Copy link

Having the exact same issue as @mreiche here. Any ideas??

@mreiche
Copy link

mreiche commented Sep 24, 2023

Having the exact same issue as @mreiche here. Any ideas??

I use podman network instead. So you could configure a network manually and reference it as external in your compose file.

@mreiche
Copy link

mreiche commented Jan 27, 2024

I came back to this, because my problem seems to be related to Podman 3.4.4 on Ubuntu 22.04 and there is no official newer version available and I need to get this fixed. So this is my workaround.

When I created an external network, I saw a list with different versions.

podman network ls
NETWORK ID    NAME        VERSION     PLUGINS
2f259bab93aa  podman      0.4.0       bridge,portmap,firewall,tuning
8ac92e008a0e  my_network  1.0.0       bridge,portmap,firewall,tuning,dnsname

and a suspicious message:

WARN[0000] Error validating CNI config file /etc/cni/net.d/my_network.conflist: [plugin bridge does not support config version "1.0.0" plugin portmap does not support config version "1.0.0" plugin firewall does not support config version "1.0.0" plugin tuning does not support config version "1.0.0"]

So I edited /etc/cni/net.d/my_network.conflist and changed the version to 0.4.0.

podman network ls
NETWORK ID    NAME        VERSION     PLUGINS
2f259bab93aa  podman      0.4.0       bridge,portmap,firewall,tuning
8ac92e008a0e  my_network  0.4.0       bridge,portmap,firewall,tuning,dnsname

This network I could use with podman-compose like:

networks:
  default:
    name: my_network
    external: true

where also DNS resolution works now.

@Antoniossss
Copy link

Antoniossss commented Jan 27, 2024 via email

@mreiche
Copy link

mreiche commented Jan 27, 2024

It's a workaround.

@Zocker1999NET
Copy link

I have the same issue on:

Weirdly, I only have this issue on the user account I specifically created for podman. On my user account on the same system, the same compose file just works. I nuked ~/.config/cni & .local/share/containers on both accounts at the start and checked before each test that the previous containers & networks were no longer listed by podman.
I also tried putting the podman account into the same groups as mine, without success. AFAIK those accounts have only a few differences where I could remotely imagine that those may could cause this issue.

Table of Differences
Account Name zocker podman
Home /home/zocker /var/lib/podman-env
UID 1000 995
Primary GID 1000 994
/etc/subuid & /etc/subgid entries zocker:100000:65536 podman:165536:65536

I tested that with this simple compose file:

version: "2"

services:
  test:
    image: hello-world

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants