Reuse existed containers upon Docker service scale [swarmkit]

With docker-compose up, usually we can reuse the existed container with just docker-compose up.

How can we achieve the same thing with docker service scale ...?
So, I want to reuse some data that was modified under that existed containers.

  • Cannot download Docker images behind a proxy
  • How to move Docker containers to AWS
  • List files in exited container
  • Attach stdin of docker container via websocket
  • docker & Quagga BGP
  • Docker Compose on Windows 7: Could not locate Gemfile or .bundle/ directory
  • Example

    $ docker service create --replicas=4 --name=test_loop ...
    $ docker ps -a
    ... STATUS              PORTS   NAMES
    ... Up 19 seconds               test_loop.1.dk4rs8eqbow3wbbjch34y287z
    ... Up 19 seconds               test_loop.2.0t7p2ab0wabrsmt6ljne3bh91
    ... Up 19 seconds               test_loop.3.57n0vhfcdfwbwbmlo0f1hghsd
    ... Up 19 seconds               test_loop.4.7wt2wittys6m37vehwffbb8ln
    $ docker service scale test_loop=2
    $ docker ps -a
    ... STATUS              PORTS   NAMES
    ... Up 3 minutes                test_loop.1.dk4rs8eqbow3wbbjch34y287z
    ... Up 3 minutes                test_loop.2.0t7p2ab0wabrsmt6ljne3bh91
    ... Exited (137) 6 seconds ago  test_loop.3.57n0vhfcdfwbwbmlo0f1hghsd
    ... Exited (137) 6 seconds ago  test_loop.4.7wt2wittys6m37vehwffbb8ln
    $ docker service scale test_loop=4
    $ docker ps -a
    ... STATUS              PORTS   NAMES
    ... Up Less than a second       test_loop.4.eplof06ud9860udsyenjckqi5  <--- Instead of creating this
    ... Up Less than a second       test_loop.3.4l8dvn361q1lba1dqakx74hvn  <--- Instead of creating this
    ... Up 4 minutes                test_loop.1.dk4rs8eqbow3wbbjch34y287z
    ... Up 4 minutes                test_loop.2.0t7p2ab0wabrsmt6ljne3bh91
    ... Exited (137) 1 minutes ago  test_loop.3.57n0vhfcdfwbwbmlo0f1hghsd  <--- I want to reuse this
    ... Exited (137) 1 minutes ago  test_loop.4.7wt2wittys6m37vehwffbb8ln  <--- I want to reuse this

  • 502 Bad Gateway when accessing virtual host via Jwilder's Nginx proxy
  • How to update a Docker container from a newer image?
  • Docker: how to use SQL file in Directory
  • Ionic in docker: Error: Please install Android target: “android-23”
  • I am not able to configure Docker VM for Lightbend ConductR. Sandbox init is throwing FileNotFoundError
  • Dockerfile RUN command taking a lot of disk space
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.