DEV Community

John Gakhokidze
John Gakhokidze

Posted on

Part 1. Docker Containers for AWS development - 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 repository
  2. From a folder containing Dockerfile run the following:

docker build -t ubuntu:ebcli.

  1. Start the container

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 repository

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

Top comments (0)