How to exec a command that doesn't end immediately in Linux node? #2044
-
I'm trying to use containerlab with What I'm trying is to build a topology with 2 hosts and 1 switch (bmv2):
I need to execute I tried Here is my name: basic
topology:
nodes:
r1:
kind: linux
image: p4lang/behavioral-model:latest
ports:
- 9559:9559
binds:
- logs:/var/log/simple_switch
# cmd: simple_switch_grpc -i 1@eth1 -i 2@eth2 --no-p4 --log-file /var/log/simple_switch/log --log-flush -L trace
exec:
- "simple_switch_grpc -i 1@eth1 -i 2@eth2 --no-p4 --log-file /var/log/simple_switch/log --log-flush -L trace"
h1:
kind: linux
image: duskmoon/dev-env:bs-u22
exec:
- ip addr add 10.0.1.2 dev eth1
- ip neigh add 10.0.1.1 lladdr 08:00:00:00:01:01 dev eth1
- ip neigh add 10.0.2.2 lladdr 08:00:00:00:02:02 dev eth1
- ip route add 10.0.0.0/16 dev eth1
- ip route change default via 10.0.1.1 dev eth1
h2:
kind: linux
image: duskmoon/dev-env:bs-u22
exec:
- ip addr add 10.0.2.2 dev eth1
- ip neigh add 10.0.2.1 lladdr 08:00:00:00:02:01 dev eth1
- ip neigh add 10.0.1.2 lladdr 08:00:00:00:01:02 dev eth1
- ip route add 10.0.0.0/16 dev eth1
- ip route change default via 10.0.2.1 dev eth1
links:
- type: veth
endpoints:
- node: r1
interface: eth1
mac: 08:00:00:00:01:01
- node: h1
interface: eth1
mac: 08:00:00:00:01:02
- type: veth
endpoints:
- node: r1
interface: eth2
mac: 08:00:00:00:02:01
- node: h2
interface: eth1
mac: 08:00:00:00:02:02 Here is the output when deploying (I used ctrl-C to stop): ❯ sudo clab deploy --reconfigure
INFO[0000] Containerlab v0.54.2 started
INFO[0000] Parsing & checking topology file: basic.clab.yml
INFO[0000] Destroying lab: basic
INFO[0001] Removed container: clab-basic-h2
INFO[0001] Removed container: clab-basic-h1
INFO[0001] Removed container: clab-basic-r1
INFO[0001] Removing containerlab host entries from /etc/hosts file
INFO[0001] Removing ssh config for containerlab nodes
INFO[0001] Removing /path/to/clab-basic directory...
INFO[0001] Creating lab directory: /path/to/clab-basic
INFO[0001] Creating container: "r1"
INFO[0001] Creating container: "h1"
INFO[0001] Creating container: "h2"
INFO[0003] Created link: r1:eth1 <--> h1:eth1
INFO[0003] Created link: r1:eth2 <--> h2:eth1
^CERRO[0025] Caught CTRL-C. Stopping deployment!
ERRO[0025] clab-basic-r1: failed to execute cmd: "simple_switch_grpc -i 1@eth1 -i 2@eth2 --no-p4 --log-file /var/log/simple_switch/log --log-flush -L trace" with error context canceled
INFO[0025] Executed command "ip addr add 10.0.1.2 dev eth1" on the node "h1". stdout:
INFO[0025] Executed command "ip neigh add 10.0.1.1 lladdr 08:00:00:00:01:01 dev eth1" on the node "h1". stdout:
INFO[0025] Executed command "ip neigh add 10.0.2.2 lladdr 08:00:00:00:02:02 dev eth1" on the node "h1". stdout:
INFO[0025] Executed command "ip route add 10.0.0.0/16 dev eth1" on the node "h1". stdout:
INFO[0025] Executed command "ip route change default via 10.0.1.1 dev eth1" on the node "h1". stdout:
INFO[0025] Executed command "ip addr add 10.0.2.2 dev eth1" on the node "h2". stdout:
INFO[0025] Executed command "ip neigh add 10.0.2.1 lladdr 08:00:00:00:02:01 dev eth1" on the node "h2". stdout:
INFO[0025] Executed command "ip neigh add 10.0.1.2 lladdr 08:00:00:00:01:02 dev eth1" on the node "h2". stdout:
INFO[0025] Executed command "ip route add 10.0.0.0/16 dev eth1" on the node "h2". stdout:
INFO[0025] Executed command "ip route change default via 10.0.2.1 dev eth1" on the node "h2". stdout:
Error: could not get container for node clab-basic-h1: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.44/containers/json?all=1&filters=%7B%22name%22%3A%7B%22%5Eclab-basic-h1%24%22%3Atrue%7D%7D": context canceled Output with debug on```shell ❯ sudo clab deploy --reconfigure --log-level debug DEBU[0000] trying to find topology files automatically DEBU[0000] topology file found: basic.clab.yml INFO[0000] Containerlab v0.54.2 started DEBU[0000] template variables: DEBU[0000] topology: name: basic
Please let me know if any other information is needed to solve this issue. My environment:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi
|
Beta Was this translation helpful? Give feedback.
Hi
try