Scaling Docker Application with Docker-Compose


version: '3.5'
services:
  petstore:
    image: petstore:latest
    hostname: petstore01
    expose:
      - "5000"#No need to bind port inside container
    environment:
      - CONFIG_FILE=/config/app1/petstore.json
      - ENVIRONMENT=staging
   - USER: admin
      - PASSWORD: password11
    volumes:
      - ./conf:/conf
nginx:
    image: nginx:latest
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
    depends_on:
      - petstore
    ports:
      - "4000:4000"
networks:
  default:
    driver: bridge
    name: petstore

Now Scale your app:
docker-compose up --scale petstore=3

The above command will start three instances of petstore application, which can be accessed at http://localhost:4000. The requests to this URL will get load balanced and distributed to one of the five petstore docker containers.


Other
published
v.1.00




For peering opportunity Autonomouse System Number: AS401345 Custom Software Development at ErnesTech Email AddressContact: [email protected]