Docker deployment always fails - massive container size

0 votes

Our website was functioning normally for a time as we tried to deploy a Flask Docker container to AWS Elastic Beanstalk. Because we began our Docker container with pip freeze in a non-virtual environment, we had more dependencies listed in requirements.txt than we were really using, resulting in a huge (5GB) container.

We attempted adding Java installation to our Dockerfile after running into a difficulty with a library (Apache Tika was working normally locally, but we were getting an error on the deployment hinting that we needed to instal Java).Since we've attempted this, nothing—not even our old repository—can be deployed on AWS. When we use "docker build," the old pip dependencies are STILL being installed and the Docker container is BIGGER, not smaller, even though I've tried deleting the Java installation and all extraneous pip dependencies from requirements.txt.

Our Dockerfile looks like:

FROM python:3.9

# Set the working directory and install the requirements
WORKDIR /server
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt

# Expose port 5000 and copy the source code
EXPOSE 5000
COPY . .

# Run the application using gunicorn
CMD ["gunicorn", "wsgi:app", "-w 2", "-b 0.0.0.0:5000", "-t 30"]

What we have tried:

What could be causing the massive size of the Docker container? How can we resolve this issue and successfully deploy the Docker container to AWS Elastic Beanstalk?

Dec 20, 2022 in AWS by Tejashwini
• 3,820 points
352 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In AWS

0 votes
2 answers

How to configure Sendmail inside a docker container?

          Here are some reference links which ...READ MORE

answered Apr 10, 2019 in AWS by nmentityvibes
• 420 points
24,060 views
+1 vote
1 answer

i have configure docker on AWS EC2 instance but commands are not working inside docker container.

Hello @Aniket , The docker exec command runs a new command ...READ MORE

answered Aug 5, 2020 in AWS by Niroj
• 82,840 points
1,693 views
+1 vote
2 answers

AWS CloudWatch Logs in Docker

The awslogs works without using ECS. you need to configure ...READ MORE

answered Sep 7, 2018 in AWS by bug_seeker
• 15,510 points
2,032 views
0 votes
1 answer
0 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,714 views
+2 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP