Table of contents
Commands to push docker image on aws
Go to AWS account -> select Amazon linux
Now go to putty -> Login as -> ec2-user
- sudo su
- yum update -y
- yum install docker -y
- service docker status
- service docker start
- docker run -it ubuntu /bin/bash
Now create some files inside container. Now create image of this container.
- docker commit container1 image1
Now create account in hub.docker.com
Now go to EC2 instances
- docker login
- enter your username and password
Now give tag to your image
- docker tag image1 dockerid/newimage
- docker push dockerid/newimage
Now you can see this image in docker hub account
Now check one instance in tokyo region and pull image from hub
- docker pull dockerid/newimage
- docker run -it --name mycon dockerid/newimage /bin/bash
some important commands
• Stop all running containers: docker stop $ ( docker ps -a -q )
• Delete all stopped container: docker rm $ ( docker ps -a -q )
• Delete all images: docker rmi -f $ ( docker images -q )