Wednesday, August 7, 2019

Run interactively,execute a command,kill container,delete container and docker hub

docker run -it -d ubuntu

-t : make the terminal interactive
-d : run the container in the background,doesn't stop until we use stop cmmand.
-p 82:80 port redirection

docker ps
to list docker contianers running.
-a : tos how even in stopped state.


docker exec -it <containerid> sh

opens a container command line..type exit to come outside.

docker stop <containerid>
docker kill <containerid>  ---if not able to stop and non-responsive..stop is like shutdown,kill is like poweroff
docker rm <containerid> -- to delete a container.
all containers delete docker (rm $(docker ps -a -q))

docker rmi <imageid> -- to delete an image


hub.docker.com
----------
docker login
docker pull/push

sudo docker commit <containerid> <dockerhubuserid>/<newimagename>
sudo docker ee37 uday1kiran/apache


No comments:

Post a Comment