Can we create multiple replica of docker container on docker desktop? How?

731 Views Asked by At

i have windows server 2019 and i have installed docker desktop on the windows server , i tried creating multiple replica using docker compose and docker stack but the container doesn,t getting ports?

Suggest me best way to create replication of docker container on windows server

below is my YAML file

version: '3.8'

services:

app1:

image: tom1

deploy:

  replicas: 3

ports:

  - 8082:80

volumes:

  - D:\APP:C:\APP

using above 3 containers are getting created but the only one container get port

1

There are 1 best solutions below

1
Shalitha Lakruwan On

Use Docker Swarm for creating replicas of containers.

Or, You can use Docker Compose to define and manage multi-container applications.

Example :

version: '3'
services:
  web:
    image: nginx:latest
    ports:
      - "80:80"
    deploy:
      replicas: 3