Skip to content

Collection of some useful docker container with composer and swarm setup with traefik support

License

Notifications You must be signed in to change notification settings

MVladislav/vm-docker-collection

Repository files navigation

Docker Collection



A docker collection with composer for a fast start-up.

  • Each service folder has its own README.

best practice start-up

use docker-swarm to manage and start containers.

for that is in each service following defined:

services:
  ...:
    ...
    deploy:
      mode: replicated
      replicas: 1
      placement:
        max_replicas_per_node: 1
        constraints:
          # - "node.id==${NODE_ID}"
          - "node.role==${NODE_ROLE}"
      restart_policy:
        condition: on-failure
    ...
    ports:
      - target: ...
        published: ...
        mode: host

to start this configuration with all supportings between docker-stack and docker-composer run it example as follow:

create alias for a docker-swarm command:

$alias docker='DOCKER_BUILDKIT=1 docker'
$alias docker-compose='docker compose'
$alias docker-swarm-compose='docker compose --compatibility config | sed '\''s|cpus: \([0-9]\+\(\.[0-9]\+\)*\)|cpus: "\1"|'\'' | sed '\''1{/^name:/d}'\'' | sed '\''s/published: "\(.*\)"/published: \1/'\'' | docker stack deploy --resolve-image=never --with-registry-auth --compose-file -'

and as run:

$docker-swarm-compose <STACK_NAME>

References


☕ COFFEE is a HUG in a MUG ☕