Docker compose kasutamine: erinevus redaktsioonide vahel
Allikas: Imre kasutab arvutit
Mine navigeerimisribaleMine otsikasti
Resümee puudub |
Resümee puudub |
||
(ei näidata sama kasutaja üht 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: |
||
40. rida: | 40. rida: | ||
[+] Running 2/2 |
[+] Running 2/2 |
||
✔ Network nw_nginx Created 0.1s |
✔ Network nw_nginx Created 0.1s |
||
− | ✔ Container |
+ | ✔ Container cn_nginx Created 0.1s |
− | Attaching to |
+ | 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: /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: Looking for shell scripts in /docker-entrypoint.d/ |
||
64. rida: | 64. rida: | ||
# docker container ls |
# docker container ls |
||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
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 |
+ | 78a420d0f791 nginx:latest "/docker-entrypoint.…" 43 minutes ago Up 1 second 0.0.0.0:8011->80/tcp cn_nginx |
</pre> |
</pre> |
||
72. rida: | 72. rida: | ||
$ docker compose -f docker-compose-nginx.yml down |
$ docker compose -f docker-compose-nginx.yml down |
||
[+] Running 2/2 |
[+] Running 2/2 |
||
− | ✔ Container |
+ | ✔ Container cn_nginx Removed 0.3s |
✔ Network nw_nginx Removed 0.1s |
✔ Network nw_nginx Removed 0.1s |
||
</pre> |
</pre> |
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