In a one time scenario you have these options:

A: To transfer your image:

  1. Save your image on your local machine:

    docker save my_image > my_image.tar

  2. Upload tar to your remote server:

    scp my_image.tar user@aws-machine:.

  3. Load image on your remote machine:

    ssh user@aws-machine

    docker load < my_image.tar

  4. Run a new container

    docker run my_image

B: To transfer your container:

  1. Export your container on your local machine:

    docker export my_container_id > my_container.tar

  2. Upload tar to your remote server:

    scp my_container.tar user@aws-machine:.

  3. Load tar as image on your remote machine:

    ssh user@aws-machine

    cat my_container | docker import - my-container-exported:latest

  4. Run a new container

    docker run my-container-exported:latest

To be prepared for later deployment improvements (like using CD/CI) you should consider option A. All necessary data for execution should be in the image and important data should be stored externally (volume mount, database, ..)

Answer from Jannik Weichert on Stack Overflow
🌐
AWS
aws.amazon.com › blogs › devops › build-and-deploy-docker-images-to-aws-using-ec2-image-builder
Build and Deploy Docker Images to AWS using EC2 Image Builder | AWS DevOps & Developer Productivity Blog
May 22, 2021 - The NFL, an AWS Professional Services partner, is collaborating with NFL’s Player Health and Safety team to build the Digital Athlete Program. The Digital Athlete Program is working to drive progress in the prevention, diagnosis, and treatment of injuries; enhance medical protocols; and further ...
Discussions

amazon ec2 - How to move Docker containers to AWS - Stack Overflow
You can use docker hub, upload ... then in ec2 pull the image. ... @SivaSai, If you have one container and one host, then push it to a Registry, ssh into the machine in the AWS, run and expose the port from the container and finally access the container application in the browser. Following is my post but its for Azure, implement it at AWS the same way. :) kjanshair.com/docker/dockeronazure ... Save this answer. ... Show activity on this post. ... To be prepared for later deployment improvements ... More on stackoverflow.com
🌐 stackoverflow.com
amazon web services - Docker, GitLab and deploying an image to AWS EC2 - Stack Overflow
I am trying to learn how to create a .gitlab-ci.yml and am really struggling to find the resources to help me. I am using dind to create a docker image to push to the docker hub, then trying to log into my AWS EC2 instance, which also has docker installed, to pull the image and start it running. More on stackoverflow.com
🌐 stackoverflow.com
How would you differentiate between Docker vs EC2 image
I am a big fan of docker. I am still learning it and I like it so much already especially with the performance on Linux. I have a question and would like to hear other’s comments. Let’s say I have a micro service to deploy and it requires some dependencies and configuration. docker is a ... More on forums.docker.com
🌐 forums.docker.com
4
0
April 8, 2015
Pushing image from DockerHub to EC2 through EC2 Connect
How to keep developing a web application on EC2 pushed from VS Code to Dockerhub and then Dockerhub to EC2 ... How do I resolve the "error pulling image configuration: toomanyrequests" error when I use Docker images in AWS CodeBuild? More on repost.aws
🌐 repost.aws
3
0
May 6, 2024
🌐
Medium
aws.plainenglish.io › deploy-docker-image-to-aws-ec2-in-5-minutes-4cd7518feacc
Deploy Docker Image to AWS EC2 in 5 minutes | AWS in Plain English
June 17, 2024 - Check out my older articles and you will find how to connect through a terminal from a Local machine. ... Everything is set up, the next step is to deploy the image from Docker Hub.
🌐
CloudBees
cloudbees.com › blog › deploying-docker-images-to-amazon-ec2-container-service-with-codeship
Deploying Docker Images to Amazon EC2 Container ...
August 24, 2016 - Reflecting Docker's microservice structure, there should ideally only ever be one CMD, and if there is more than one, only the last will matter. If your container needs something more complex, then use the ENTRYPOINT command. The CMD and ENTRYPOINT instructions can be used to specify the default commands that run when a container starts. When used in conjunction with CMD for parameters, ENTRYPOINT sets the main command for the image, allowing you to run an image as if it were that command.
🌐
Medium
medium.com › @chandupriya93 › deploying-docker-containers-with-aws-ec2-instance-265038bba674
Deploying Docker containers with AWS EC2 Instance. | by Mallireddy Chandu Priya | Medium
October 17, 2019 - Deploying Docker containers with AWS EC2 Instance. In this article, I will explain you how to deploy your Docker container/Image in AWS EC2 Instance. What is EC2 instance? An EC2 instance is nothing …
🌐
GitHub
github.com › aws-samples › build-and-deploy-docker-images-to-aws-using-ec2-image-builder
GitHub - aws-samples/build-and-deploy-docker-images-to-aws-using-ec2-image-builder · GitHub
In this project, we walk through the process of building a Docker image and deploying the image to Amazon ECR, share some security best practices, and demonstrate deploying a Docker image to Amazon Elastic Container Service (Amazon ECS). Additionally, we dive deep into building Docker images following modern principles.
Starred by 20 users
Forked by 12 users
Languages   Java 69.3% | Dockerfile 30.7%
Find elsewhere
🌐
AWS Builder Center
builder.aws.com › content › 2zpEHjeCPYYYpGKsIPncX4iM6ds › how-to-deploy-a-docker-container-on-an-amazon-ec2-instance
How to deploy a Docker container on an Amazon EC2 instance | AWS Builder Center
July 13, 2025 - After deployment, go to the EC2 Instances page to find your instance’s public IP address. NOTE: This section of the lab assumes that you are now familiar with Provisioning EC2 Instances and can manage EC2 Instances. ... From your terminal, go to the directory where your EC2 key pair was downloaded. In this lab, my key pair is named. docker-container.pem After that, run the following command:
🌐
Klotzandrew
klotzandrew.com › blog › deploy-an-ec2-to-run-docker-with-terraform
Deploy an EC2 to run Docker with Terraform | Andrew Klotz
April 18, 2020 - module "dev_ssh_sg" { source = "terraform-aws-modules/security-group/aws" name = "ec2_sg" description = "Security group for ec2_sg" vpc_id = data.aws_vpc.default.id ingress_cidr_blocks = ["127.0.0.1/32"] ingress_rules = ["ssh-tcp"] } module "ec2_sg" { source = "terraform-aws-modules/security-group/aws" name = "ec2_sg" description = "Security group for ec2_sg" vpc_id = data.aws_vpc.default.id ingress_cidr_blocks = ["0.0.0.0/0"] ingress_rules = ["http-80-tcp", "https-443-tcp", "all-icmp"] egress_rules = ["all-all"] } We need an AMI ID for our instance. AMI IDs change per region and over time, our filters will just look for the latest from amazon. Afterward, we wire up our EC2 to the security groups and profile we created. This container needs to run docker containers, so we add a user_data script that installs both docker and docker-compose.
🌐
Docker Community
forums.docker.com › docker engine › general
How would you differentiate between Docker vs EC2 image - General - Docker Community Forums
April 8, 2015 - I am a big fan of docker. I am still learning it and I like it so much already especially with the performance on Linux. I have a question and would like to hear other’s comments. Let’s say I have a micro service to deploy and it requires some dependencies and configuration. docker is a perfect solution for deployment.
🌐
Softsuave
softsuave.com › home › how to deploy a docker container on an aws ec2 instance
How to Deploy a Docker Container on an AWS EC2 Instance
October 30, 2025 - To begin with, we would initially start an EC2 instance, which we would then manually install Docker on. After that, we’ll run Docker images directly on the instance. Avoid using the latest tags for base images.
Top answer
1 of 3
3
Hi Rajeev Bagra 1.Docker Installation: Update the package index: ``` sudo apt update ``` Install prerequisites: ``` sudo apt install apt-transport-https ca-certificates curl software-properties-common ``` Add the Docker GPG key: ``` curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - ``` Add the Docker repository: ``` sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" ``` Update the package index again: ``` sudo apt update ``` Install Docker: ``` sudo apt install docker-ce `` Verify that Docker is installed: ``` sudo docker --version ``` 2.Pushing Images to Docker Registry: Log in to your Docker registry: ``` docker login ``` Tag your Docker image with the registry URL: ``` docker tag : /: ``` Push the tagged image to the Docker registry: ``` docker push /: ```
2 of 3
4
hello, i am sharing some commands and steps to Push image from Docker Hub to EC2. first connect to your ec2- server then run following commands ``` $ sudo yum install docker $ sudo yum install docker $ sudo service docker start $ sudo docker login # Enter your DockerHub username and password ``` ``` $ sudo docker pull digitalsplendid/my-flask-app $ docker tag digitalsplendid/my-flask-app /my-flask-app #this command i used to tag that image it looks already taged to your Docker Hub so you can skip it now. $ docker push /my-flask-app #this command to push it to your Docker Hub ``` these are the commands you can use to resolve this issue and this commands for AWS Linux server if you're using ubuntu try to use apt instead of yum you can find that commands online. i hope this will be helpful to you.
🌐
AWS
docs.aws.amazon.com › amazon ecr › user guide › private images in amazon ecr › pushing an image to an amazon ecr private repository › pushing a docker image to an amazon ecr private repository
Pushing a Docker image to an Amazon ECR private repository - Amazon ECR
3 weeks ago - To authenticate Docker to an Amazon ECR registry, run the aws ecr get-login-password command. When passing the authentication token to the docker login command, use the value AWS for the username and specify the Amazon ECR registry URI you want to authenticate to.
🌐
Medium
mahira-technology.medium.com › a-step-by-step-guide-to-deploy-docker-containers-on-aws-ec2-instance-296eef5ed7e0
A Step-by-Step Guide To Deploy Docker Containers On AWS EC2 Instance | by Mahira Technology- Innovate. Transform. Thrive. | Medium
January 16, 2025 - How to Deploy Docker Images on an EC2 Instance · We will manually spin EC2 instance and install Docker. After we set up docker, we will run a docker image. ... Go to EC2 in the AWS Console.
🌐
DEV Community
dev.to › ansuman-satapathy › deploying-a-multi-stage-docker-image-to-aws-ec2-using-docker-hub-4noh
Deploying a Multi-Stage Docker Image to AWS EC2 using Docker Hub - DEV Community
July 27, 2024 - So, in this article I'll be sharing how to dockerize a Spring Boot application, push it to Dockerhub and finally deploy it to an AWS EC2 instance. If you're looking to get a Spring Boot To-Do application up and running in the cloud, you're in the right place. We'll walk through cloning the app from GitHub, creating a Docker image, and deploying it to AWS EC2.
🌐
Hashnode
harshdevopss.hashnode.dev › beginners-docker-tutorial-how-to-deploy-on-aws-ec2
Deploy Docker on AWS EC2: Beginner's Guide
December 13, 2024 - Beginner's tutorial on deploying Docker containers on AWS EC2, including installation and essential Docker commands for easy container management
🌐
GitLab
forum.gitlab.com › gitlab ci/cd
Gitlab Docker Deployment to AWS ec2 - GitLab CI/CD - GitLab Forum
June 13, 2020 - HI Team, Actually I have a Reppository in micro services project and we need to deploy the code as a docker container using docker-compose in an AWS ec2. I have used the below script to do that image: gitlab/dind:latest services: docker:dind before_script: docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY stages: build deploy build: stage: build script: docker build -t $CI_REGISTRY/$CI_PROJECT_PATH:latest . docker push $CI_REGISTRY/$CI_PROJECT_PATH:latest tags: docker d...