简体   繁体   中英

How do I make a container accessible over the local network in docker-compose v3?

I would assume I need to set the container to use a bridge network. This seems possible with docker-compose v2, but I can't seem to find resources for docker-compose v3.

https://docs.docker.com/compose/networking/ does not even contain "bridge".

By default, docker compose v3 also uses bridge network. If you dont specify network, bridge driver gets used.

If you want to use custom driver, default driver can be changed like this:

networks:
  default:
    # Use a custom driver
    driver: custom-driver-1

If pre-existing network needs to be used, following option can be used:

networks:
  default:
    external:
      name: my-pre-existing-network

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM