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.

  • docker build is not work
  • Docker pull for nanoserver / windowsservercore failing with message failed to register layer access is denied exactly at the end of extract
  • Run commands on create a new Docker container
  • docker toolbox: Is there a way to mount other folders than from c:\Users Windows?
  • bin mounted to alpine container fails to run with /gogs not found
  • How does device mapper “union” docker images
  • Docker container not starting
  • Explanation about Supervisor and tail over Apache's error.log
  • How can I use a docker container with a self signed certificate on osx?
  • using docker/containers + not able to visit server in browser
  • How to make environmental variables available to Docker RUN commands from docker-compose?
  • docker run mongo image on a different port
  • 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.