Docker compose kasutamine: erinevus redaktsioonide vahel

Allikas: Imre kasutab arvutit
Mine navigeerimisribaleMine otsikasti
Resümee puudub
Resümee puudub
29. rida: 29. rida:
 
driver: bridge
 
driver: bridge
 
</pre>
 
</pre>
  +
  +
kus
  +
  +
* tundub, et uuemal ajal ei ole asjakohane compose failis kasutada rida 'version: xxx'
   
 
Kasutamiseks sobib öelda
 
Kasutamiseks sobib öelda
61. rida: 65. rida:
 
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 dc_nginx
 
78a420d0f791 nginx:latest "/docker-entrypoint.…" 43 minutes ago Up 1 second 0.0.0.0:8011->80/tcp dc_nginx
  +
</pre>
  +
  +
Konteineri ja võrgu kustutamiseks sobib öelda
  +
  +
<pre>
  +
$ docker compose -f docker-compose-nginx.yml down
  +
[+] Running 2/2
  +
✔ Container dc_nginx Removed 0.3s
  +
✔ Network nw_nginx Removed
 
</pre>
 
</pre>
   

Redaktsioon: 29. mai 2024, kell 13:28

Sissejuhatus

TODO

Tööpõhimõte

TODO

Käsundamine

Isikliku võrgu jms ressurssidega konteineri tekitamine

# 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

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 dc_nginx  Created                                                                                                                                                                                                   0.1s 
Attaching to dc_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      dc_nginx

Konteineri ja võrgu kustutamiseks sobib öelda

$ docker compose -f docker-compose-nginx.yml down
[+] Running 2/2
 ✔ Container dc_nginx  Removed                                                                                                                                                                                                   0.3s 
 ✔ Network nw_nginx    Removed   

Kasulikud lisamaterjalid