相关疑难解决方法(0)

How to simply scale a docker-compose service and pass the index and count to each?

I'm looking for a way to scale up a docker-compose service & saw the --scale option but could not find any method to get the index & count within each container.

Here's a simplified compose file:

version: '2.1'
services:
  my_thing:
    restart: always
    build: .
    entrypoint: /entry.sh
    depends_on:
      - database
  database:
    restart: always
    image: postgres:12.1-alpine
    ...
Run Code Online (Sandbox Code Playgroud)

If I did docker-compose up my_thing --scale 5 within the entry I'd like to be able to see which instance I am (1 to 5) …

docker docker-compose docker-swarm

11
推荐指数
1
解决办法
3702
查看次数

标签 统计

docker ×1

docker-compose ×1

docker-swarm ×1