Visual Studio Code Extension

I have been using Visual Studio Code + Torizon extension to develop and debug an Uno Platform application.

Debugging has been going fine until, i think, a update.
My project runs up a Weston container and my application container.
The problem is may application has no access to the internet.

Originally the application had been working using the host interface (192.168.x.x).
This has now changed to a 172.17.x.x.
This is the docker0 interface which does not appear to give me access to the internet.

So my question is, how do i give my application container access to the host interface (192.168.x.x)
from visual studio code?

Hi @ObiTwo ,

By default a container started with docker run is in an isolated network.

You can specify an option to run the container with the same network stack that the Docker host (i.e. the SoM) is in. Putting the following line in your application container entry in docker-compose.yml should do the trick:

network_mode: "host"

You can see more details in the Docker documentation:

Best regards,
Lucas Akira

Hi Lucas,

I have searched for the docker-compose.yml in my visual studio code project bu can only find
docker-compose.yml.debug.
This already has the network-mode: host entry in the appconfig_0/work/docker-compose.yml.debug

My software is still picking up the 172 address for eth0.

Any change i make to the docker-compose.yml.debug is overwritten when debugging starts.

How do i specify which network to use within the Torizon extension so that the application uses the 192.168 address (ethernet0) instead of the 172 (docker0)?

I have looked at the container running my application (within the Torizon extension) and it is showing the networkSettings as bridge, but i can’t see where i would change this.

Hi @ObiTwo ,

This already has the network-mode: host entry in the appconfig_0/work/docker-compose.yml.debug

I see, you’re using the old Torizon IDE Extension V1, Toradex Torizon Support. The instructions I mentioned before were for the new Torizon IDE Extension 2.

In the old extension the Dockerfiles and the docker-compose.yml shouldn’t be directly edited, as any changes you make there will be overwritten, as you saw.

Instead you need to change the Extension configs to apply these changes. For instance, if you want to put the network mode to host in both debug and release:

  • Click on the Torizon icon and then in configurations find an option called networks. There add a new value named host, as shown in the screenshot below:

image

After that see if your container has access to the local network.

You can find more information about these Extension V1 config options on this page:


As a side note, the old extension is currently deprecated, and it will be removed in the future. While we still support it, we recommend using the newer Torizon IDE Extension 2 whenever possible, as it has a different workflow that allows directly editing Dockerfiles/Docker compose files.

You can get started with the Torizon IDE Extension 2 here:

Best regards,
Lucas Akira