brain initiation
This commit is contained in:
14
20230420004718-docker_networks.org
Normal file
14
20230420004718-docker_networks.org
Normal file
@@ -0,0 +1,14 @@
|
||||
:PROPERTIES:
|
||||
:ID: 9d04fac3-89ae-4a96-b326-9ae7e2c22118
|
||||
:END:
|
||||
#+title: docker-networks
|
||||
A [[id:df046fd7-1f82-4e12-9065-56d222f56408][docker]] network is a virtual network that connects [[id:936191f2-696b-4d9a-96ad-c8449778ae26][containers]]. Without this network no two docker containers could interact with eachother. In [[id:fcbfabfa-4a8c-4826-8b57-5dce05965c76][docker-compose]] the network is set with:
|
||||
#+begin_src
|
||||
networks:
|
||||
- <name of network>
|
||||
#+end_src
|
||||
If you don't specify a network in the compse file the default network is invoked, so that the listed container can interact. When the container is set up wit the docker run command, the network is specified with the added parameter:
|
||||
#+begin_src
|
||||
--network "<name of network>"
|
||||
#+end_src
|
||||
The usage of networks comes in handy when you want to connect two containers like [[id:7c74176b-a637-4d3b-838e-05fae7ad3789][nextcloud]] and [[id:ae46c92b-d5fd-4172-944f-9165a61d2217][maria_DB]]. in docker-compos a network can be set as internal (define the network inside the compose file) or external (add the containers to an existing network).
|
||||
Reference in New Issue
Block a user