Docker container has no network

Viewed 92

I have the following docker-compose.yml file:

version: '3.7'

services:
  chrome:
    image: "image1:v0-1-1"
    restart: "no"
    networks:
      - internal

  grpc:
    image: "image2:v0-1-1"
    restart: "no"
    networks:
      - internal
    depends_on:
      - chrome

networks:
  internal:
    name: internal
#    driver: bridge

After running docker-compose up -d --remove-orphans grpc container (image2) has none network, but chrome container (image1) has internal network.

I have faced this strange issue for the first time. What is the problem?

I have the latest version of docker and docker-compose.

1 Answers

Your compose file should be like this try this

version: '3.7'

services:
  chrome:
    image: "image1:v0-1-1"
    restart: "no"
    networks:
      - internal

  grpc:
    image: "image2:v0-1-1"
    restart: "no"
    networks:
      - internal
    depends_on:
      - chrome

networks:
  internal: {}
    
Related