Docker compose kasutamine: erinevus redaktsioonide vahel
Allikas: Imre kasutab arvutit
Mine navigeerimisribaleMine otsikasti
(Uus lehekülg: '===Sissejuhatus=== TODO ===Tööpõhimõte=== TODO ===Käsundamine=== Isikliku võrgu jms ressurssidega konteineri tekitamine <pre> # cat docker-compose-nginx.yml services: service_nginx: image: nginx:latest ports: - "8011:80" container_name: dc_nginx networks: - nw_nginx networks: nw_nginx: name: nw_nginx driver: bridge </pre> ===Kasulikud lisamaterjalid=== * TODO') |
Resümee puudub |
||
(ei näidata sama kasutaja 5 vahepealset redaktsiooni) | |||
14. rida: | 14. rida: | ||
# cat docker-compose-nginx.yml |
# cat docker-compose-nginx.yml |
||
services: |
services: |
||
+ | svc_nginx: |
||
− | service_nginx: |
||
image: nginx:latest |
image: nginx:latest |
||
ports: |
ports: |
||
- "8011:80" |
- "8011:80" |
||
− | container_name: |
+ | container_name: cn_nginx |
networks: |
networks: |
||
30. rida: | 30. rida: | ||
</pre> |
</pre> |
||
+ | kus |
||
+ | * tundub, et uuemal ajal ei ole asjakohane compose failis kasutada rida 'version: xxx' |
||
+ | |||
+ | Kasutamiseks sobib öelda |
||
+ | |||
+ | <pre> |
||
+ | $ docker compose -f docker-compose-nginx.yml up |
||
+ | [+] Running 2/2 |
||
+ | ✔ Network nw_nginx Created 0.1s |
||
+ | ✔ Container cn_nginx Created 0.1s |
||
+ | Attaching to cn_nginx |
||
+ | dc_nginx | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration |
||
+ | dc_nginx | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ |
||
+ | dc_nginx | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh |
||
+ | ... |
||
+ | </pre> |
||
+ | |||
+ | Ning tulemusena on moodustunud sellised ressursid |
||
+ | |||
+ | <pre> |
||
+ | $ docker network ls |
||
+ | NETWORK ID NAME DRIVER SCOPE |
||
+ | 3fe6d3988e37 bridge bridge local |
||
+ | 617b4a0d5de5 host host local |
||
+ | d4743d12eb6a none null local |
||
+ | 67a9effbfa9b nw_nginx bridge local |
||
+ | </pre> |
||
+ | |||
+ | ning |
||
+ | |||
+ | <pre> |
||
+ | # docker container ls |
||
+ | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
||
+ | 78a420d0f791 nginx:latest "/docker-entrypoint.…" 43 minutes ago Up 1 second 0.0.0.0:8011->80/tcp cn_nginx |
||
+ | </pre> |
||
+ | |||
+ | Konteineri ja võrgu kustutamiseks sobib öelda |
||
+ | |||
+ | <pre> |
||
+ | $ docker compose -f docker-compose-nginx.yml down |
||
+ | [+] Running 2/2 |
||
+ | ✔ Container cn_nginx Removed 0.3s |
||
+ | ✔ Network nw_nginx Removed 0.1s |
||
+ | </pre> |
||
===Kasulikud lisamaterjalid=== |
===Kasulikud lisamaterjalid=== |
||
+ | * https://medium.com/@kesaralive/diving-deeper-into-docker-networking-with-docker-compose-737e3b8a3c8c |
||
− | * TODO |
Viimane redaktsioon: 29. mai 2024, kell 13:39
Sissejuhatus
TODO
Tööpõhimõte
TODO
Käsundamine
Isikliku võrgu jms ressurssidega konteineri tekitamine
# cat docker-compose-nginx.yml services: svc_nginx: image: nginx:latest ports: - "8011:80" container_name: cn_nginx networks: - nw_nginx networks: nw_nginx: name: nw_nginx driver: bridge
kus
- tundub, et uuemal ajal ei ole asjakohane compose failis kasutada rida 'version: xxx'
Kasutamiseks sobib öelda
$ docker compose -f docker-compose-nginx.yml up [+] Running 2/2 ✔ Network nw_nginx Created 0.1s ✔ Container cn_nginx Created 0.1s Attaching to cn_nginx dc_nginx | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration dc_nginx | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ dc_nginx | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh ...
Ning tulemusena on moodustunud sellised ressursid
$ docker network ls NETWORK ID NAME DRIVER SCOPE 3fe6d3988e37 bridge bridge local 617b4a0d5de5 host host local d4743d12eb6a none null local 67a9effbfa9b nw_nginx bridge local
ning
# docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 78a420d0f791 nginx:latest "/docker-entrypoint.…" 43 minutes ago Up 1 second 0.0.0.0:8011->80/tcp cn_nginx
Konteineri ja võrgu kustutamiseks sobib öelda
$ docker compose -f docker-compose-nginx.yml down [+] Running 2/2 ✔ Container cn_nginx Removed 0.3s ✔ Network nw_nginx Removed 0.1s