After running the container, my connection with the server is disconnected

Hello,
The docker-compose.yml file is as follows:

services:
  banner:
    container_name: Project
    build:
      context: /data/project
      dockerfile: Dockerfile
    ports:
      - "3000:3000"
    environment:
      - PORT=3000
    command: npm start

And the Dockerfile is as follows:

FROM node:latest

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY package*.json ./
RUN npm install --force
COPY . .

EXPOSE 3000
CMD npm start

I am connecting via SSH to the host where Docker is installed. When I run the container, I am disconnected from the host and I have to connect to the host through the virtual machine panel and stop docker. The network settings after disconnection are as follows:

br-0b2663e31b9f: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.21.0.1  netmask 255.255.0.0  broadcast 172.21.255.255
        inet6 fe80::42:5dff:fe70:4496  prefixlen 64  scopeid 0x20<link>
        ether 02:42:5d:70:44:96  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10  bytes 748 (748.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:2eff:fe78:15ea  prefixlen 64  scopeid 0x20<link>
        ether 02:42:2e:78:15:ea  txqueuelen 0  (Ethernet)
        RX packets 243669  bytes 25181737 (24.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 278149  bytes 420043936 (400.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens192: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.20.2.100  netmask 255.255.0.0  broadcast 172.20.255.255
        inet6 fe80::250:56ff:feb0:7aac  prefixlen 64  scopeid 0x20<link>
        ether 00:50:56:b0:7a:ac  txqueuelen 1000  (Ethernet)
        RX packets 47249392  bytes 9400289575 (8.7 GiB)
        RX errors 0  dropped 2568  overruns 0  frame 0
        TX packets 4730307  bytes 1743732975 (1.6 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 4043294  bytes 7918521674 (7.3 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4043294  bytes 7918521674 (7.3 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

What is wrong?

Thank you.

It seems your LAN connection (ens192) suddenly has a private IP (172.20.2.100).

Not sure how that can happen, it shouldn’t be directly related to that container.

Did you mess with Docker config, network or firewall settings on host?

Hello,
Thank you so much for your reply.
The 172.20.2.100 is the IP address of the host NIC.