Docker - docker-compose.yml

Card Puncher Data Processing

Example

version: "3"
services:
  web:
    # replace username/repo:tag with your name and image details
    image: username/repo:tag
    deploy:
      replicas: 5
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      restart_policy:
        condition: on-failure
    ports:
      - "80:80"
    networks:
      - webnet
networks:
  webnet:

where:

  • web define the name of the service as web
  • image: defines the image to pull
  • replicas defines the number of instances to run
  • limits limits each replica to use, at most, 10% of the CPU (across all cores), and 50MB of RAM.
  • restart_policy defines that a replica must restart on failure
  • ports map the port 80 on the host to web’s port 80. See Docker - Port
  • webnet defines a load-balanced network that shares the port 80 (Internally, the containers themselves publish to web’s port 80 at an ephemeral port.). The default settings is a load-balanced overlay network.

Managment

Run the specified Compose file. See Docker - App

docker swarm init
docker stack deploy -c <composefile> <appname>   

Configuration

Port

Port linkage

version: '2'

services:

  serviceName:
    ports:
      - "8080:8080"
      - "80:80"
      - ...

Network

version: '2'

services:

  serviceName:
    networks:
      - netWorkName

networks:

  networkName:
    driver: bridge

See: Network - Bridge Driver

Documentation / Reference





Discover More
Card Puncher Data Processing
Docker - App

An app is an ensemble of service and defines the notion of instance of a compose file. There is one to one relationship between an app and a compose file Run the specified Compose file where:...
Card Puncher Data Processing
Docker - Scale (Number of container for a service)

Scale sets the number of containers to run for a service. It will overrides the scale setting in the Compose file if present. Added in version 2.2 file format. Version...
Card Puncher Data Processing
Docker - Service

Services in the context of docker are really just containers. To define, run just write a docker-compose.yml file and run it as an app List running services associated with an app List tasks...
Card Puncher Data Processing
Docker - Volume Mount

in Docker. A volume is one type of mount in docker. Volumes are one of the way of persisting data between container execution. They are file store on the host where you can persist data generated by...
Card Puncher Data Processing
Docker - docker-compose

Docker Compose is a powerful tool that enables you to launch multiple Docker images in a coordinated fashion. Compose is a tool for defining and running multi-container Docker applications. Compose uses...
Card Puncher Data Processing
Docker-Compose - Project

Compose uses a project name to isolate environments from each other. The default project name is based on the name of the directory where the docker-compose.yml is located (ie the basename of the project...
Kafka Commit Log Messaging Process
Kafka - Docker Single Node (Multiple Service Broker + Zookeeper)

Docker Single Node step by step tutorial adapted from the Quickstart documentation. Made: on Windows 7 with Git Bash for Windows...
Kafka Commit Log Messaging Process
Kafka - Ksql

Without the LIMIT keyword, the SELECT query would run indefinitely until you stop it by pressing ==== Persistent Query ==== Unlike the non-persistent query above, Results from this query are written...
Card Puncher Data Processing
Kibana

is the visualisation tool of . Docker: Configuration kibana.yml Xpack...



Share this page:
Follow us:
Task Runner