Docker ~ Use the existing network in yml and the existing network in dockeryml

Source: Internet
Author: User
Tags docker swarm

Docker ~ Use the existing network in yml and the existing network in dockeryml

Back to directory

When deploying a highly available cluster using docker swarm, we may need to configure some services in the yml file, and these services may need to use some public databases, these databases may already run in a container, and these containers have their own network and docker inspect container ID to view the network used by the container, use docker network ls to view the network currently created by docker.

In yml version 3, let's take a look at how to use the existing network

Version: "3" services: nginx: image: nginx networks:-core-infranetworks: core-infra: external: true

It is also possible to create a mongodb instance using an existing network.

Version: "3" services: mongodb: image: mongo: latest ports:-"27017: 27017" networks:-test-networknetworks: test-network: external: true

If you do not add the external parameter, it will create a new network, and the network prefix will be a service name, which is clear!

Article reference: http://www.dockerinfo.net/4245.html

Thank you for reading this article!

Back to directory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.