- Published on
How to Deploy a Docker Container to AWS in 15 Minutes
You can deploy a Docker container to AWS in under 15 minutes by using AWS App Runner, a fully managed service that handles server provisioning and scaling automatically. This method eliminates the need to manage complex infrastructure like EC2 (Elastic Compute Cloud) instances or Kubernetes clusters. By connecting your GitHub repository or an image registry directly to App Runner, your application becomes accessible via a secure URL almost instantly.
Why should you choose AWS App Runner for your first deployment?
AWS App Runner is designed for developers who want to focus on code rather than server maintenance. It automatically handles load balancing (distributing incoming traffic across multiple servers) and SSL (Secure Sockets Layer - the technology that keeps internet connections secure). We've found that this service is the most forgiving path for beginners because it provides a clear interface and minimizes the number of manual steps required to go live.
This service also scales automatically based on how many people are visiting your site. If traffic spikes, App Runner adds more resources to keep the site fast. When traffic drops, it scales back down to save you money on cloud costs.
What do you need before getting started?
Before you begin the deployment process, ensure you have a few basic tools installed on your computer. You will need an AWS account, which offers a Free Tier for new users to experiment without immediate costs. You also need Docker Desktop installed to build and test your containers locally.
For this guide, we will use a simple Python application as our example. Ensure you have a code editor like VS Code installed to manage your files. Finally, you should have a basic understanding of how to use a terminal (the text-based interface used to run commands).
How do you prepare your application for Docker?
Docker works by taking a "snapshot" of your application and all its dependencies into a single package called an image. To do this, you need a special file named Dockerfile in your project folder. This file acts as a recipe that tells Docker how to build your environment.
Create a file named Dockerfile (with no file extension) and paste the following code:
# Use the latest stable Python version as of late 2026
FROM python:3.14-slim
# Set the working directory inside the container
WORKDIR /app
# Copy your local code into the container
COPY . .
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Make port 8080 available to the world outside this container
EXPOSE 8080
# Run the application using Python
CMD ["python", "app.py"]
The python:3.14-slim image is a lightweight version of Python that keeps your container small and fast. The EXPOSE command tells AWS which port your application is listening on for web traffic. Don't worry if your app uses a different port; you just need to make sure the EXPOSE value matches your code.
How do you push your Docker container to AWS?
AWS provides a private storage area for your images called ECR (Elastic Container Registry). Think of ECR as a private library where AWS stores your container images before they are deployed. You must upload your image here so App Runner can find it.
Step 1: Open your terminal and log in to AWS ECR using the AWS CLI (Command Line Interface).
Step 2: Build your image locally by running docker build -t my-web-app . in your project folder.
Step 3: Tag your image with your AWS repository URL so Docker knows where to send it.
Step 4: Run the docker push command to upload the file to the cloud.
What you should see: A series of progress bars in your terminal as the different "layers" of your application are uploaded to AWS. Once finished, you will see a success message and the image will appear in your AWS Console under the ECR section.
How do you launch the container using App Runner?
Now that your image is in the cloud, you can tell App Runner to turn it into a live website. Navigate to the AWS App Runner console and click "Create service." This starts a wizard that will guide you through the final connection steps.
Step 1: Select "Container registry" as your source and choose the ECR image you just uploaded. Step 2: Choose "Manual" deployment for now, which means the site only updates when you tell it to. Step 3: Give your service a name, like "my-first-web-app," and set the port to 8080. Step 4: Click "Create and Deploy" at the bottom of the page.
What you should see: A status screen showing "Deployment in progress" with a spinning icon. This usually takes about 3 to 5 minutes as AWS sets up the networking and starts your container. When the status turns green and says "Running," you will see a "Default domain" link that you can click to view your live site.
What are the common mistakes to avoid?
It is normal to run into a few hurdles during your first deployment. One frequent issue is a "Port Mismatch," where the application is running on port 5000 inside the container, but App Runner is looking for it on port 8080. Always double-check that your Dockerfile and your App Runner settings use the exact same port number.
Another common gotcha involves IAM (Identity and Access Management) permissions. If you see an "Access Denied" error when pushing your image, it means your local computer doesn't have the right permissions to talk to AWS. You can fix this by running aws configure in your terminal and ensuring your Access Keys are correct.
Finally, remember that cloud services cost money if left running indefinitely. If you are just practicing, be sure to "Delete" the service in the App Runner console when you are finished. This stops the billing cycle and prevents unexpected charges on your credit card.
Next Steps
Now that you have successfully deployed a container, you can explore more advanced features like GPT-5 integrations or Claude Sonnet 4 APIs to add AI capabilities to your app. You might also want to look into "Automatic Deployments," which update your website every time you push new code to GitHub. Learning how to manage environment variables (secret keys and settings) is another great skill to tackle next.
For more detailed guides, visit the official Docker documentation.