Skip to content

Compose ignores network settings #432

@bluescreen10

Description

@bluescreen10

When launching containers using nerdctl compose I noticed that the logs says "Ignoring: network mynet: [Ipam] " and upon further inspection I see that nerdctl uses the default ip range (10.4.x.x) instead of the one specified in the compose file.

Steps to reproduce

docker-compose.yml

version: '3'

services:
  test:
    image: alpine:latest
    networks:
      - mynet
    command:
      - ifconfig

networks:
  mynet:
    name: mynet
    ipam:
      config:
        - subnet: 172.16.1.0/24

output

$ nerdctl compose up
INFO[0000] Creating network nerdctl_default             
WARN[0000] Ignoring: network mynet: [Ipam]              
INFO[0000] Creating network mynet                       
INFO[0000] Ensuring image alpine:latest                 
docker.io/library/alpine:latest:                                                  resolved       |++++++++++++++++++++++++++++++++++++++| 
index-sha256:e1c082e3d3c45cccac829840a25941e679c25d438cc8412c2fa221cf1a824e6a:    done           |++++++++++++++++++++++++++++++++++++++| 
manifest-sha256:69704ef328d05a9f806b6b8502915e6a0a4faa4d72018dc42343f511490daf8a: done           |++++++++++++++++++++++++++++++++++++++| 
config-sha256:14119a10abf4669e8cdbdff324a9f9605d99697215a0d21c360fe8dfa8471bab:   done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:a0d0a0d46f8b52473982a3c466318f479767577551a53ffc9074c9fa7035982e:    done           |++++++++++++++++++++++++++++++++++++++| 
elapsed: 1.8 s                                                                    total:  2.7 Mi (1.5 MiB/s)                                       
INFO[0001] Creating container nerdctl_test_1            
INFO[0002] Attaching to logs                            
test_1 |eth0      Link encap:Ethernet  HWaddr 72:E3:6C:BB:BE:8D  
test_1 |          inet addr:10.4.7.2  Bcast:10.4.7.255  Mask:255.255.255.0
test_1 |          inet6 addr: fe80::70e3:6cff:febb:be8d/64 Scope:Link
test_1 |          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
test_1 |          RX packets:7 errors:0 dropped:0 overruns:0 frame:0
test_1 |          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
test_1 |          collisions:0 txqueuelen:0 
test_1 |          RX bytes:526 (526.0 B)  TX bytes:218 (218.0 B)
test_1 |
test_1 |lo        Link encap:Local Loopback  
test_1 |          inet addr:127.0.0.1  Mask:255.0.0.0
test_1 |          inet6 addr: ::1/128 Scope:Host
test_1 |          UP LOOPBACK RUNNING  MTU:65536  Metric:1
test_1 |          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
test_1 |          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
test_1 |          collisions:0 txqueuelen:1000 
test_1 |          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
test_1 |
INFO[0002] Container "nerdctl_test_1" exited            
INFO[0002] All the containers have exited               
INFO[0002] Stopping containers (forcibly)               
INFO[0002] Stopping container nerdctl_test_1 

As you can see the container has an assigned ip of 10.4.7.2 instead of 172.16.1.x

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions