AWS Development — Docker Containers for — Elastic Beanstalk development environment

AWS developers need to install many tools like awscli, eb cli, ecs-cli, sam etc. Workstations become overloaded, and sometimes there are version conflicts. To keep workstations clean, we decided to use Docker containers for different tools.

I hear you say, how about running
eb local run

And here is how we will do that:

  1. Download Dockerfile from VirtIOGroove
  2. From a folder containing Dockerfile run the following:

docker build -t ubuntu:ebcli.

docker run -v /var/run/docker.sock:/var/run/docker.sock -it ubuntu:ebcli

Now you are in the container.

Let us quick create an Elastic Beanstalk Application from AWS provided examples, by executing the following commands:

mkdir testdocker
cd testdocker
wget https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/samples/docker.zip
unzip docker.zip
eb init #select Docker platform
eb local run & #pushing it to background to get shell

And here is the magic — the new Docker Container starts from your developer Docker Container — but it runs on the host.

If you run
docker container ps from your container or from the host -you will see the same container - this is the result of attaching a Docker daemon socket from the host to the container Docker daemon.
More options for starting container can be found in VirtIOGroove

Note: Do not run the container with --privileged=true
Read this from the author of the feature - to understand implications. That is why we are starting container the way recommended in blog post.

Originally published at on August 30, 2020.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store