Docker stack: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 34: Line 34:
version: '3.7'
version: '3.7'
volumes:
volumes:
   c3-pg-db:
   pg-db:
services:
services:
   c3-pg:
   pg:
     image: mdillon/postgis:${POSTGRES_VERSION}
     image: mdillon/postgis:${POSTGRES_VERSION}
     ports:
     ports:
       - "5432:5432"
       - "5432:5432"
     volumes:
     volumes:
       - "c3-pg-db:/var/lib/postgresql/data"
       - "pg-db:/var/lib/postgresql/data"


</syntaxhighlight>
</syntaxhighlight>
Line 52: Line 52:


Remove one or more stacks.
Remove one or more stacks.
docker stack rm test-stack


=Examples=
=Examples=


  docker stack ps --namespace ''namespace-name'' ''stack-name''
  docker stack ps --namespace ''namespace-name'' ''stack-name''

Revision as of 22:11, 9 August 2019

External

Internal

Overview

docker stack --orchestrator kubernetes <command>

Commands

ls

List stacks.

ps

List the tasks in the specified stack.

deploy

Deploy a new stack or update an existing stack.

docker stack deploy -c ./docker-compose-test.yml --namespace default test-stack

Example of a specification file that deploys PostgreSQL:

---
version: '3.7'
volumes:
  pg-db:
services:
  pg:
    image: mdillon/postgis:${POSTGRES_VERSION}
    ports:
      - "5432:5432"
    volumes:
      - "pg-db:/var/lib/postgresql/data"

services

List the services in the stack.

rm

Remove one or more stacks.

docker stack rm test-stack

Examples

docker stack ps --namespace namespace-name stack-name