Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsupported config option for services.networks: 'my_network'

I am having below error while running the docker-compose file. I have created a bridge network with name my_network

Unsupported config option for services.networks: 'my_network'

docker-compose.yml

version: '3.3'
services:
  webapp1:
    image: nginx:latest
    container_name: my_container
    ports:
      - "8080:8080"
    networks:
      - my_network
    volumes:
      - /home/ajay/nginx:/www/data
like image 500
AJAY KUMAR DAS Avatar asked Oct 16 '22 02:10

AJAY KUMAR DAS


1 Answers

That seems docker-compose configuration issue, use below docker-compose file, it will create a network and then you can use the same network in the docker-compose file.

version: '3.5'

services:
  webapp1:
    image: nginx:latest
    container_name: my_container
    ports:
      - "8080:80"
    networks:
      - my_network

networks:
  my_network:
    driver: bridge

Also Nginx port should be 80 inside the container if you did not modify the default configuration.

like image 96
Adiii Avatar answered Oct 18 '22 14:10

Adiii