0% found this document useful (0 votes)
4 views

Docker Commands

Uploaded by

Charan
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Docker Commands

Uploaded by

Charan
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

to get an image form docket pull use the (docker pull image name)

and

(docker images) to see the images

to run that image use the command name (docker run -it -d imagename) then only
container is formed.

here=-it means iterative with terminal

and -d means deatched mode i.e run container in background even i close the
terminal or

anything

the ps command to show the active process in our system (docker ps) ----to show the
containers

if there are any stopped containers they can be seen by adding the -a flag then

(docker ps -a)

to enter into a [container] we have the command named (docker exec -it containerid
bash)

and click enter

docker stop containerid and then only we can delete

if we want to delete the running container then (docker rm -f containerid)

docker kill containerid

docker rm containerid (to remove the stopped container )

docker rmi imageid (to remove an images )

-----------------------------------------------------------------------------------
------

SAVING CHANGES INTO A CONTAINER:-docke

(docker commit containerid newimagename) --> this creates a new image and
then run

the container

-----------------------------------------------------------------------------------
------
TO REMOVE ALL THE CONTAINERS AT A ONE TIME:

docker rm -f $(docker ps -a -q) ----which remove all containers at one time.

-----------------------------------------------------------------------------------
--------

to check whether our apache2 server is runnning or not use this command

(service apache2 status) (gives either running or not)

if it is not running

(service apache2 start)

-----------------------------------------------------------------------------------
-------

(docker run -it -p 82:80 -d charansai1432/apache)-------------to send it to


docker-

hub

here -p = port mapping apt

82:80 =----- indicates that 82 port of our local system is communicating with
the port number 80 to the container

NOTE:- HERE we taken port as 80 ------ due to apache2 server communicate with port
no. 80

charansai1432/newimagename---------which is used to push into our docker hub


account.

-----------------------------------------------------------------------------------
--------

You might also like