Docker - 6
How to psuh docker image in dockerhub
=====================================
Now go to putty -> Login as
-> Sudo su
-> yum update -y
-> yum install docker -y
-> 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 your server
-> docker login
-> enter your username and password
Now give tag to your image
-> docker tag image1 docker id/newimage
-> docker push dockerid/newimage
Now you can see this iamge in docker hub account
Now create 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
=====================
1) Stop all running containers:
docker stop $(docker ps -a -q)
2) Delete all stopped containers: -
docker rm $(docker ps -a -q)
3) delete all images:-
docker rmi -f $(docker images -q)
how to restart the container if gets stopped.
docker run -d --restart=always -p 80:80 -i -t myuser/myproj /bin/bash
how to stop the container from auto-start
docker update --restart=no my-container
if you want to apply to stop auto start on all container.
Use the below to disable ALL auto-restarting (daemon) containers.
docker update --restart=no $(docker ps -a -q)
Comments
Post a Comment