标签云

微信群

扫码加入我们

WeChat QR Code

I am using a bash script to spin up a virtual network with two docker containers on it. This feels prehistoric. Is there some tool that can spin such an ensemble up and down & show its current status, or does one have to take care of that on their own? In case docker-compose, it is unclear from docker documentation whether docker-compose is self-contained or tied to swarm, and an authoritative example of a compose definition file, with commands for starting and stopping the ensemble would be very helpful.E.g. here is what a bash script would do to define/start an application of two interrelated containers, needless to say this script does not help with managing its lifecycle beyond just starting it up once.docker network create --driver bridge FooAppNetdocker run --rm --net=FooAppNet --name=component1 -p 9000:9000 component1-imagedocker run --rm --net=FooAppNet --name=component2 component2-imageAlso in this example, container component1 exposes port 9000 to the host, and its contained application has it hardwired in its configuration file, to consume the service of component2 by its name (following the common docker networking practice relying on docker networks' internal DNS).


Probably best to start with Docker Compose. You can use it independently of Swarm.

2019年04月20日24分35秒

Separately running docker network create --driver bridge makes it all, well, not self-contained. (pun intended). Also posted about the latter key part as a separate question now.

2019年04月20日24分35秒

For enjoying the default network created for the project by compose, need to also remove the net: lines above from the configuration. In short, see here ― docs.docker.com/compose/networking

2019年04月19日24分35秒