How to launch two ros2 packages with a docker default bridge network?

Viewed 13

Hi I have successfully created two docker containers namely 'system' and 'talos'. Im following this docker tutorial Use the default bridge network to connect two containers to the bridge network. So when run docker network ls i have

NETWORK ID     NAME            DRIVER    SCOPE
82112b61bf59   bridge          bridge    local
8a72f325ea75   host            host      local
67674800c2fa   none            null      local
f2d88359a204   ros_net         bridge    local
b7051a9478be   sim_net         bridge    local
44b694c60cc8   talos_default   bridge    local

So according to the tutorial first I run both containers :

docker run -dit --name talos talos
docker run -dit --name system  ghcr.io/deepx-inc/backhoe_vnc_ros2:foxy

Then check that both containers are actually started

docker container ps:

CONTAINER ID   IMAGE                                     COMMAND         CREATED         STATUS         PORTS     NAMES
04942e8f7036   talos                                     "/startup.sh"   4 minutes ago   Up 4 minutes   80/tcp    talos
e45cdedbb7c7   ghcr.io/deepx-inc/backhoe_vnc_ros2:foxy   "/startup.sh"   5 minutes ago   Up 5 minutes   80/tcp    system

Then inspect the bridge network to see what containers are connected to it.

docker network inspect bridge
[
    {
        "Name": "bridge",
        "Id": "82112b61bf596238efa6eddda3df681fde9cb0528c3d367d7ba620cd388681d1",
        "Created": "2022-09-15T10:15:23.263590943+09:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.17.0.0/16",
                    "Gateway": "172.17.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "04942e8f7036c699c8919bbbfbd1d98cd8fee3e4968789c9f98d0766d48dd920": {
                "Name": "talos",
                "EndpointID": "29fb3c06bb0e32b6b68bd9b7ffc1f9d53547ecbfb705346d658a73b3f4c43c38",
                "MacAddress": "02:42:ac:11:00:02",
                "IPv4Address": "172.17.0.2/16",
                "IPv6Address": ""
            },
            "e45cdedbb7c7dd38d15c1a08f6975f35ac507c02ed88d280251ee422a6a74684": {
                "Name": "system",
                "EndpointID": "84ee3df46fe2d07e7d016d6bac6b91dec3f31836b61dae2382eb002ae7f62759",
                "MacAddress": "02:42:ac:11:00:03",
                "IPv4Address": "172.17.0.3/16",
                "IPv6Address": ""
            }
        },
        "Options": {
            "com.docker.network.bridge.default_bridge": "true",
            "com.docker.network.bridge.enable_icc": "true",
            "com.docker.network.bridge.enable_ip_masquerade": "true",
            "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
            "com.docker.network.bridge.name": "docker0",
            "com.docker.network.driver.mtu": "1500"
        },
        "Labels": {}
    }
]

Which all looks good . Both containers connected to the bridge. Then use docker attach command to connect to system. so when run docker attach system nothing happened. Im not in the root container directory. What Im doing wrong?

0 Answers
Related