In a one time scenario you have these options:
A: To transfer your image:
Save your image on your local machine:
docker save my_image > my_image.tarUpload tar to your remote server:
scp my_image.tar user@aws-machine:.Load image on your remote machine:
ssh user@aws-machinedocker load < my_image.tarRun a new container
docker run my_image
B: To transfer your container:
Export your container on your local machine:
docker export my_container_id > my_container.tarUpload tar to your remote server:
scp my_container.tar user@aws-machine:.Load tar as image on your remote machine:
ssh user@aws-machinecat my_container | docker import - my-container-exported:latestRun 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 OverflowI am a complete beginner. What’s the step by step process of deploying a docker container in ec2 FREE TIER ? I am confused by YouTube videos. Reddit please help.