Table of Contents
Step 1: Docker Export in Machine 1:
sudo docker export ngjenkins | gzip > ngjenkins.gz
Step 2: Run From Machine 1 to copy .gz file to Machine 2:
scp -i "my-docker-pair.pem" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ngjenkins.gz ec2-user@YOUR_AWS_HOST_NAME:/home/ec2-user/
.pem file is mandatory to connect with any AWS machine in AWS environments. If you don’t have that file in your server, make sure to copy that in your aws machine from your local computer using the below command.
scp -i my-docker-pair.pem d:/aws/my-docker-pair.pem ec2-user@YOUR_AWS_HOST_NAME:/home/ec2-user/my-docker-pair.pem
Step 3: Docker Import in Machine 2:
zcat ngjenkins.gz | docker import - ngjenkins
Step 4: Docker Run in Machine 2:
docker run -i -t ngjenkins /bin/bash
ngjenkins is my docker name which is running on machine 1