why is my elastic beanstalk instance being replaced when I deploy?

I have a docker based elastic beanstalk environment, hosting a ruby on rails web application. The environment is a single instance box.
whenever I issue an eb deploy command, elastic beanstalk terminates the instance and launches a new one. I was expecting that EB would launch a new container in the same instance and swap it with the old one.
This instance termination is causing downtime. Is there an automated way to deploy docker into elastic beanstalk without downtime?
the only solution I found was the “swap URLs” feature. but I found it cumbersome.

  • Simple docker command does not work: x509: cannot validate certificate
  • why do my docker containers on SLES 12 take 2x memory compared to Ubuntu?
  • Link images on Docker Hub
  • cant run boot2docker in win 7 64bit strange virtual box error
  • How to search images from private 1.0 registry in docker?
  • Insert data after mysql started in a docker container
  • Auto-synch data in container upon changes in host
  • Synced Folder Error with Docker Provider on Vagrant
  • Docker and git deployment workflow confusion
  • Docker for windows - Internal server error
  • Docker volume recreates a new target path every time
  • “assets:install” command fails with error “The target directory ”web“ does not exist”, why?
  • 2 Solutions collect form web for “why is my elastic beanstalk instance being replaced when I deploy?”

    Under your configuration settings for your Elastic Beanstalk environment you will find Updates and Deployments. Under Application Deployments you can set the Batch type to meet your requirements.

    For this process you will be required to increase your running instances to at least two.

    Is there an automated way to deploy docker into elastic beanstalk without downtime?

    1. Push a new docker image to the same dockerbub/dockerregistry repository with the same tag that you used in elastic beanstalk.
    2. Change the Beanstalk size to 2 to launch a new server with the new version of your docker container.
    3. Terminate the older instance and allow EB to replace it, wait until replacement becomes healthy.*
    4. Change EB size back to 1.

    * If your do not let the second instance get healthy when your reduce size to 1 it may terminate the healthy one.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.