Unsupported config option for services.networks: 'my_network'

11,582

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.

Share:
11,582
Admin
Author by

Admin

Updated on June 16, 2022

Comments

  • Admin
    Admin about 2 years

    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